diff --git a/cg/cg4300.h b/cg/cg4300.h index 6f740a02a..0dd232f62 100755 --- a/cg/cg4300.h +++ b/cg/cg4300.h @@ -500,7 +500,7 @@ public: bool set_deleghe(); bool extract_deleghe(); bool extract_delega(int m, TArray& desc); - bool video_conferma(const real&, const real&, const real&); + bool video_conferma(const real&, const real&, const real&, bool to_del = FALSE); // stampa void set_deltab(_DescrItem& d, bool iscred); diff --git a/cg/cg4305.cpp b/cg/cg4305.cpp index 73f19e134..0e2706704 100755 --- a/cg/cg4305.cpp +++ b/cg/cg4305.cpp @@ -248,7 +248,19 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) tt->add(desc); } else if (wasdel) //se esiste e no versare - _del->remove(); + { + bool stampato = _del->get_bool("B0"); + TString buf; + buf.format("Il versamento relativo alla ditta %ld e' gia' stato stampato. Si desidera eliminare il flag di stampa definitiva?",_nditte->lfile().get_long("CODDITTA")); + if (stampato && yesno_box(buf)) + { // Se la delega e' gia' stampata in definitva, chiede se deve eliminare il flag di stampa + _del->put("B0",FALSE); + _del->rewrite(); + } + // Se non e' stampata invece visualizza la delega presente su file e l'importo a credito che ha calcolato + // chiedendo cosa fare: Registra elimina fisicamente la delega dal file, Annulla lo fa proseguire + if (!stampato) video_conferma(topay, intr, nrnd, TRUE); + } } if (tt != NULL && !skip_print) // Se il tabulato deve essere stampato per questa delega... @@ -258,11 +270,11 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc) } bool TLiquidazione_app::video_conferma(const real& newimp, const real& intr, - const real& narr) + const real& narr, bool to_del) { TMask m("cg4800b"); - m.set_caption("Estrazione versamenti"); // Modifica il titolo... + m.set_caption(to_del ? "Conferma eliminazione" : "Estrazione versamenti"); // Modifica il titolo... m.field(F_CODDITTA).set(_nditte->lfile().get("CODDITTA")); m.field(F_RAGSOC).set(_nditte->lfile().get("RAGSOC")); m.field(F_DATAVER).set(_del->get_date("D0")); @@ -270,7 +282,15 @@ bool TLiquidazione_app::video_conferma(const real& newimp, const real& intr, m.field(F_CAB).set(_del->get("S8")); m.field(F_CON).set(_del->get("S9")); m.field(F_IMPVER).set(_del->get("R0")); - m.field(F_NEWIMP).set(newimp.string()); + if (to_del) + { + real xr = abs(newimp); + m.hide(F_NEWIMP); + m.show(F_NEWIMPCRED);m.disable(F_NEWIMPCRED); + m.field(F_NEWIMPCRED).set(xr.string()); + } + else + m.field(F_NEWIMP).set(newimp.string()); KEY k; for (bool stop = FALSE; !stop;) @@ -281,14 +301,22 @@ bool TLiquidazione_app::video_conferma(const real& newimp, const real& intr, { case K_SAVE: { - k = yesnocancel_box("Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?"); + k = yesnocancel_box(to_del ? + "Delega gia' stampata. Si desidera veramente confermare l'eliminazione?" + : + "Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?"); if (k == K_YES) { - _del->put("B0", ""); - _del->put("R0",newimp); - _del->put("R1",intr); - _del->put("R2",narr); - _del->rewrite(); + if (to_del) + _del->remove(); + else + { + _del->put("B0", ""); + _del->put("R0",newimp); + _del->put("R1",intr); + _del->put("R2",narr); + _del->rewrite(); + } } if (k == K_YES || k == K_NO) stop = TRUE; @@ -453,7 +481,11 @@ bool TLiquidazione_app::recalc_acconto(real& inf, real& ina) if (ohh == 'M') history = thh == 'M' ? mm : mt; if (ohh == 'T') history = thh == 'M' ? tm : tt; - if (history == boh) return FALSE; + if (history == boh) + { + _year = thyear; + return FALSE; + } // casino benzinari TString attprev = _nditte->curr().get("CODATTPREV");