Patch level : 10.0
Files correlati : ha0.exe ha0300a.msk ha2.exe Ricompilazione Demo : [ ] Commento : Bottone fatturazione contratti premio Corretto invio Esselunga git-svn-id: svn://10.65.10.50/branches/R_10_00@22512 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
05ac3b61a3
commit
8e431f0eb1
@ -4,13 +4,11 @@
|
||||
|
||||
#include <mov.h>
|
||||
#include <cfven.h>
|
||||
#include <doc.h>
|
||||
#include <rdoc.h>
|
||||
|
||||
#include "../mg/umart.h"
|
||||
#include "../ve/velib04.h"
|
||||
|
||||
#include "../ve/condv.h"
|
||||
#include "../ve/rcondv.h"
|
||||
#include "../ve/clifor.h"
|
||||
|
||||
#include "halib.h"
|
||||
#include "ha0.h"
|
||||
@ -23,14 +21,15 @@ class TDocumenti_premio_msk : public TAutomask
|
||||
{
|
||||
protected:
|
||||
char find_prezzo_articolo(const TString& codart, real& prezzo, TString& um) const;
|
||||
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
public:
|
||||
const TString& find_contabilizzazione() const;
|
||||
TDocumenti_premio_msk();
|
||||
};
|
||||
|
||||
|
||||
TDocumenti_premio_msk::TDocumenti_premio_msk() : TAutomask("ha0300a")
|
||||
{
|
||||
}
|
||||
@ -126,6 +125,19 @@ char TDocumenti_premio_msk::find_prezzo_articolo(const TString& codart, real& pr
|
||||
return origine_prezzo;
|
||||
}
|
||||
|
||||
const TString& TDocumenti_premio_msk::find_contabilizzazione() const
|
||||
{
|
||||
TISAM_recordset eld("USE %ELD SELECT (I0=\"3\")&&(S5=#CODNUM)&&(S7[1,1]=#STATO)");
|
||||
eld.set_var("#CODNUM", get(F_CODNUM));
|
||||
eld.set_var("#STATO", get(F_STATO));
|
||||
if (eld.move_first())
|
||||
{
|
||||
CHECKD(eld.items() == 1, "Troppe contabilizzazioni:", eld.items());
|
||||
return eld.get("CODTAB").as_string();
|
||||
}
|
||||
return EMPTY_STRING;
|
||||
}
|
||||
|
||||
bool TDocumenti_premio_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
@ -186,6 +198,25 @@ bool TDocumenti_premio_msk::on_field_event(TOperable_field& o, TField_event e, l
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLG_ELABORA:
|
||||
if (e == fe_button && edit_mode())
|
||||
{
|
||||
const TString8 cod_eld = find_contabilizzazione();
|
||||
if (cod_eld.full())
|
||||
{
|
||||
TContabilizzazione eld(cod_eld);
|
||||
TLista_documenti doc_in, doc_out;
|
||||
|
||||
TRelation_application& app = (TRelation_application&)main_app();
|
||||
TDocumento* doc = new TDocumento(app.get_relation()->curr());
|
||||
doc_in.add(doc);
|
||||
if (eld.elabora(doc_in, doc_out, TDate(TODAY)))
|
||||
set(F_STATO, doc->stato());
|
||||
}
|
||||
else
|
||||
return error_box(TR("Contratto non valido per la contabilizzazione"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
@ -395,6 +426,7 @@ void TDocumenti_premio::write_rows(const TMask& m)
|
||||
void TDocumenti_premio::init_query_mode(TMask& m)
|
||||
{
|
||||
m.disable(F_STATO);
|
||||
m.disable(DLG_ELABORA);
|
||||
}
|
||||
|
||||
void TDocumenti_premio::init_insert_mode(TMask& m)
|
||||
@ -402,11 +434,13 @@ void TDocumenti_premio::init_insert_mode(TMask& m)
|
||||
//alla creazione di un nuovo contratto lo stato viene posto = 2
|
||||
//questo x' il contratto è già stato stampato dal cliente in fase di stesura
|
||||
m.set(F_STATO, 2);
|
||||
m.disable(DLG_ELABORA);
|
||||
}
|
||||
|
||||
void TDocumenti_premio::init_modify_mode(TMask& m)
|
||||
{
|
||||
m.disable(F_TIPOCONTR); //non si può cambiare il tipo contratto una volta stabilito sennò non funziona + un cazzo
|
||||
m.enable(DLG_ELABORA, _msk->find_contabilizzazione().full());
|
||||
}
|
||||
|
||||
bool TDocumenti_premio::remove()
|
||||
|
@ -2,7 +2,19 @@
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
|
||||
#include <relapbar.h>
|
||||
#include <filebar.h>
|
||||
|
||||
BUTTON DLG_NULL 2 2
|
||||
BEGIN
|
||||
PROMPT -1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_ELABORA 2 2
|
||||
BEGIN
|
||||
PROMPT 3 1 "Contabilizza"
|
||||
END
|
||||
|
||||
#include <cancelbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
@ -70,7 +82,7 @@ BEGIN
|
||||
WARNING "Cliente assente"
|
||||
HELP "Codice del cliente del documento"
|
||||
FIELD CODCF
|
||||
USE LF_CLIFO KEY 1
|
||||
USE LF_CLIFO SELECT (GRUPPO=4) && (CONTO=201) && (SOSPESO!="X")
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCF
|
||||
DISPLAY "Codice" CODCF
|
||||
@ -88,7 +100,7 @@ BEGIN
|
||||
WARNING "Cliente assente"
|
||||
HELP "Ragione sociale del cliente del documento"
|
||||
PROMPT 24 2 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
USE LF_CLIFO KEY 2 SELECT (GRUPPO=4) && (CONTO=201) && (SOSPESO!="X")
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_DESCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
@ -106,7 +118,7 @@ BEGIN
|
||||
WARNING "Inserire un codice >= 200000"
|
||||
HELP "Codice del cliente cui fatturare >= 200000"
|
||||
FIELD DOC2
|
||||
COPY USE F_CODCF
|
||||
USE LF_CLIFO SELECT (GRUPPO=4) && (CONTO=101) && (SOSPESO!="X")
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCFATT
|
||||
COPY DISPLAY F_CODCF
|
||||
@ -121,7 +133,7 @@ BEGIN
|
||||
WARNING "Cliente assente"
|
||||
HELP "Ragione sociale del cliente cui fatturare"
|
||||
PROMPT 24 3 ""
|
||||
COPY USE F_DESCF
|
||||
USE LF_CLIFO KEY 2 SELECT (GRUPPO=4) && (CONTO=101) && (SOSPESO!="X")
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_DESCFATT
|
||||
COPY DISPLAY F_DESCF
|
||||
|
@ -284,7 +284,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("DET.CODEANTU", AN, 35, 57);
|
||||
add_field("DET.CODFORTU", AN, 35, 92);
|
||||
add_field("DET.CODDISTU", AN, 35, 127);
|
||||
add_field("DET.TIPQUANT", AN, 3, 162);
|
||||
add_field("DET.TIPQUANT", AN, 3, 162); // L01=Vendita L02=Reso
|
||||
add_field("DET.QTACONS", NS, 16, 165);
|
||||
add_field("DET.UDMQCONS", AN, 3, 181, true, "PCE");
|
||||
add_field("DET.QTAFATT", NS, 16, 184);
|
||||
@ -563,17 +563,16 @@ void THardy_esselunga_fat::add_recs_dettaglio(TFatture_recordset& fat, TDocument
|
||||
continue;
|
||||
const TRectype& rec_anamag = cache().get(LF_ANAMAG, codart);
|
||||
fat.new_rec("DET");
|
||||
long rl(r);
|
||||
fat.set("DET.NUMRIGA", TVariant(rl));
|
||||
fat.set("DET.NUMRIGA", long(r));
|
||||
fat.set("DET.CODEANCU", codart_esselunga);
|
||||
fat.set("DET.CODDISTU", codart_esselunga);
|
||||
fat.set("DET.TIPQUANT", "L01"); // vendita (sentire da robbi)
|
||||
fat.set("DET.QTACONS", rigadoc->quantita());
|
||||
fat.set("DET.QTAFATT", rigadoc->quantita());
|
||||
fat.set("DET.TIPQUANT", "L01"); // vendita ; L02 reso
|
||||
fat.set("DET.QTACONS", rigadoc->quantita());
|
||||
fat.set("DET.QTAFATT", rigadoc->quantita());
|
||||
fat.set("DET.NRCUINTU", rec_anamag.get_real(ANAMAG_PPCONF));
|
||||
fat.set("DET.PRZUNI", rigadoc->prezzo(false, true));
|
||||
fat.set("DET.PRZUN2", rigadoc->prezzo(false, false));
|
||||
fat.set("DET.IMPORTO", rigadoc->importo(false, false));
|
||||
fat.set("DET.PRZUNI", rigadoc->prezzo(false, false));
|
||||
fat.set("DET.PRZUN2", rigadoc->prezzo(true, false));
|
||||
fat.set("DET.IMPORTO", rigadoc->importo(true, false));
|
||||
|
||||
fat.new_rec("DES");
|
||||
fat.set("DES.DESCR", rigadoc->get(RDOC_DESCR));
|
||||
|
Loading…
x
Reference in New Issue
Block a user