Ricompilate personalizzazioni per Sicuri
git-svn-id: svn://10.65.10.50/branches/R_10_00@22818 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9ad7adc80c
commit
ff77324017
@ -7,21 +7,12 @@ int main(int argc, char** argv)
|
||||
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
pg0001200(argc, argv); break; // ricezione movimenti da .... e invio a TS (SIPAG)
|
||||
case 2:
|
||||
pg0001300(argc, argv); break; // conversione da excel a colonne fisse per studio vitali
|
||||
case 3:
|
||||
pg0001400(argc, argv); break; // stampa bollettini postali Condeco
|
||||
case 4:
|
||||
pg0001500(argc, argv); break; // copia movimenti magazzino AZ
|
||||
case 5:
|
||||
pg0001600(argc, argv); break; // ricezione clienti e movimenti da paghe
|
||||
case 0:
|
||||
default:
|
||||
pg0001100(argc, argv);
|
||||
break; //ricezione fatture da paghe (SIPAG)
|
||||
case 1: pg0001200(argc, argv); break; // ricezione movimenti da .... e invio a TS (SIPAG)
|
||||
case 2: pg0001300(argc, argv); break; // conversione da excel a colonne fisse per studio vitali
|
||||
case 3: pg0001400(argc, argv); break; // stampa bollettini postali Condeco
|
||||
case 4: pg0001500(argc, argv); break; // copia movimenti magazzino AZ
|
||||
case 5: pg0001600(argc, argv); break; // ricezione clienti e movimenti da paghe
|
||||
default:pg0001100(argc, argv); break; // ricezione fatture da paghe (SIPAG)
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
@ -17,6 +17,7 @@
|
||||
#include "doc.h"
|
||||
#include "rdoc.h"
|
||||
|
||||
#include "../cg/cfban.h"
|
||||
#include "..\cg\cglib01.h"
|
||||
#include "..\ve\velib.h"
|
||||
|
||||
@ -182,7 +183,6 @@ public:
|
||||
virtual void main_loop();
|
||||
void add_testata(const TRecordset& paghe, TConfig& doc);
|
||||
void add_riga_doc(const TRecordset& paghe, TConfig& doc, const int nriga, const TString& codivaes);
|
||||
TPaghe2Doc() {}
|
||||
};
|
||||
|
||||
TPaghe2Doc& app() { return (TPaghe2Doc&) main_app(); }
|
||||
@ -214,8 +214,39 @@ void TPaghe2Doc::add_testata(const TRecordset& paghe, TConfig& doc)
|
||||
doc.set(DOC_TIPODOC, _tipodoc);
|
||||
doc.set(DOC_DATADOC, _datadoc);
|
||||
doc.set(DOC_TIPOCF, "C");
|
||||
doc.set(DOC_CODCF, paghe.get("CLAZI").as_string());
|
||||
|
||||
const long codcli = paghe.get("CLAZI").as_int();
|
||||
doc.set(DOC_CODCF, codcli);
|
||||
doc.set(DOC_STATO, _stato);
|
||||
|
||||
TToken_string key;
|
||||
key = "C";
|
||||
key.add(codcli);
|
||||
key.add("V");
|
||||
key.add("1");
|
||||
|
||||
const TRectype& cfban = cache().get(LF_CFBAN, key);
|
||||
TString8 abi = cfban.get(CFBAN_ABI);
|
||||
TString8 cab = cfban.get(CFBAN_CAB);
|
||||
if (atol(abi) <= 0 || atol(cab) <= 0)
|
||||
{
|
||||
const TRectype& cfven = cache().get(LF_CFVEN, key);
|
||||
abi = cfven.get(CFV_CODABIPR);
|
||||
cab = cfven.get(CFV_CODCABPR);
|
||||
}
|
||||
|
||||
if (atol(abi) > 0 && atol(cab) > 0)
|
||||
{
|
||||
doc.set(DOC_CODABIA, abi);
|
||||
doc.set(DOC_CODCABA, cab);
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg; msg << "Il cliente " << codcli << " è privo di ABI/CAB";
|
||||
_log->log(2, msg);
|
||||
_errors_logged = true;
|
||||
}
|
||||
|
||||
doc.set_paragraph(format("%d,%d",LF_RIGHEDOC, 1));
|
||||
doc.set(RDOC_CHECKED, "X");
|
||||
doc.set(RDOC_TIPORIGA, _rigadesc);
|
||||
@ -322,7 +353,7 @@ void TPaghe2Doc::main_loop()
|
||||
delete docum;
|
||||
docum = NULL;
|
||||
}
|
||||
if (error) // cancello il file perch'e la transazione non e' andata bene
|
||||
if (error) // cancello il file perché la transazione non è andata bene
|
||||
{
|
||||
TFilename pgfile; pgfile.tempdir();
|
||||
pgfile.add(format("pg000%03d.ini",ntransac));
|
||||
@ -341,16 +372,24 @@ void TPaghe2Doc::main_loop()
|
||||
nriga = 1;
|
||||
// calcolo se cliente esente
|
||||
const long codcli = paghe.get("CLAZI").as_int();
|
||||
TString8 k; k.format("C|%ld", codcli);
|
||||
const TRectype& cfven = cache().get(LF_CFVEN, k);
|
||||
if (cfven.empty())
|
||||
{
|
||||
TString msg; msg << "Non esiste il cliente " << codcli;
|
||||
_log->log(2, msg);
|
||||
_errors_logged = true;
|
||||
}
|
||||
|
||||
const TCli_for c('C', codcli);
|
||||
const TCodiceIVA codes(c.vendite().get(CFV_ASSFIS));
|
||||
const TCli_for c('C', codcli);
|
||||
const TCodiceIVA codes(c.vendite().get(CFV_ASSFIS));
|
||||
const TString16 v_esenzione(c.vendite().get(CFV_VSPROT));
|
||||
const TString16 v_data_esenzione(c.vendite().get(CFV_VSDATAREG));
|
||||
const TString16 n_registrazione(c.vendite().get(CFV_NSPROT));
|
||||
const TString16 n_data_registrazione(c.vendite().get(CFV_NSDATAREG));
|
||||
esente = codes.tipo().not_empty() && v_esenzione.not_empty() &&
|
||||
v_data_esenzione.not_empty() && n_registrazione.not_empty() &&
|
||||
n_data_registrazione.not_empty();
|
||||
esente = codes.tipo().full() && v_esenzione.full() &&
|
||||
v_data_esenzione.full() && n_registrazione.full() &&
|
||||
n_data_registrazione.full();
|
||||
if (esente)
|
||||
codivaes = codes.codice();
|
||||
else
|
||||
@ -360,11 +399,6 @@ void TPaghe2Doc::main_loop()
|
||||
add_riga_doc(paghe, *docum, nriga, codivaes);
|
||||
}
|
||||
}
|
||||
if (docum != NULL)
|
||||
{
|
||||
delete docum;
|
||||
docum = NULL;
|
||||
}
|
||||
if (error) // cancello il file perché la transazione non e' andata bene
|
||||
{
|
||||
TFilename pgfile; pgfile.tempdir();
|
||||
@ -372,18 +406,17 @@ void TPaghe2Doc::main_loop()
|
||||
if (pgfile.exist())
|
||||
remove_file(pgfile);
|
||||
}
|
||||
TReport_book book;
|
||||
book.add(*_log);
|
||||
book.preview();
|
||||
_log->preview();
|
||||
delete _log;
|
||||
_log = NULL;
|
||||
|
||||
bool save = true;
|
||||
if (_errors_logged)
|
||||
{
|
||||
save = yesno_box(TR("Sono stati riscontrati uno o piu' errori:\n"
|
||||
"Si desidera creare i documenti ugualmente?"));
|
||||
}
|
||||
delete _log;
|
||||
_log = NULL;
|
||||
save = noyes_box(FR("Sono stati riscontrati uno o piu' errori:\n"
|
||||
"Si desidera creare %ld documenti ugualmente?"), ntransac);
|
||||
else
|
||||
save = yesno_box(FR("Si desidera procedere con la generazione di %ld documenti?"), ntransac);
|
||||
|
||||
if (save)
|
||||
{
|
||||
TString applicat;
|
||||
|
@ -97,7 +97,7 @@ bool TImport_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
||||
class TImport_app : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
virtual const char* extra_modules() const { return "ca|ve"; }
|
||||
virtual const char* extra_modules() const { return "cm|ve"; }
|
||||
virtual void main_loop();
|
||||
|
||||
public:
|
||||
@ -270,7 +270,10 @@ bool TImport_app::importa_clienti(const TFilename& fname, const TString& cdc, TL
|
||||
curr.put(CLI_RAGSOC, ragsoc.get());
|
||||
curr.put(CLI_REFERENTE, curr.get(CLI_RAGSOC));
|
||||
|
||||
curr.put(CLI_INDCF, cli.get(8).as_string());
|
||||
const TString& indir = cli.get(8).as_string();
|
||||
curr.put(CLI_INDCF, indir);
|
||||
if (isdigit(indir.right(1)[0]))
|
||||
curr.zero(CLI_CIVCF);
|
||||
|
||||
const TString80 loc = cli.get(10).as_string();
|
||||
curr.put(CLI_LOCCF, loc);
|
||||
@ -302,6 +305,7 @@ bool TImport_app::importa_clienti(const TFilename& fname, const TString& cdc, TL
|
||||
|
||||
const TString8 abi = cli.get(17).as_string();
|
||||
const TString8 cab = cli.get(18).as_string();
|
||||
const TString80 numcc = cli.get(23).as_string();
|
||||
if (abi.len() == 5 && cab.len() == 5)
|
||||
{
|
||||
TToken_string key;
|
||||
@ -312,8 +316,8 @@ bool TImport_app::importa_clienti(const TFilename& fname, const TString& cdc, TL
|
||||
TRectype& rec = nsban.row(1, true);
|
||||
rec.put(CFBAN_ABI, abi);
|
||||
rec.put(CFBAN_CAB, cab);
|
||||
rec.put(CFBAN_NUMCC, cli.get(23).as_string());
|
||||
|
||||
rec.put(CFBAN_NUMCC, numcc);
|
||||
|
||||
key.cut(0) << abi << cab;
|
||||
const TString& iban = cache().get("BNP", key, "S3");
|
||||
rec.put(CFBAN_IBAN, iban);
|
||||
@ -325,6 +329,11 @@ bool TImport_app::importa_clienti(const TFilename& fname, const TString& cdc, TL
|
||||
str.cut(0) << TR("Impossibile aggiornare la banca di ") << ragsoc << TR(" alla riga ") << (cli.current_row()+1);
|
||||
log.log(1, str);
|
||||
}
|
||||
|
||||
// Copialo anche sul cliente per tradizione
|
||||
curr.put(CLI_CODABI, abi);
|
||||
curr.put(CLI_CODCAB, cab);
|
||||
curr.put(CLI_NUMCC, numcc);
|
||||
}
|
||||
|
||||
curr.put(CLI_CODPAG, cli.get(20).as_string());
|
||||
@ -386,9 +395,9 @@ const TString& TImport_app::get_periodo(const TCBA_recset& fat) const
|
||||
TString80 periodo;
|
||||
fat.get(10).as_string(periodo);
|
||||
|
||||
if (periodo[0] >= '0' && periodo[0] <= '9')
|
||||
if (periodo[0] >= '0' && periodo[0] <= '9' && periodo.len() > 4)
|
||||
{
|
||||
const int mese = atoi(periodo.left(6 - periodo.len()));
|
||||
const int mese = atoi(periodo.left(periodo.len()-4));
|
||||
if (mese >= 1 && mese < 12)
|
||||
{
|
||||
int anno = atoi(periodo.right(4));
|
||||
@ -421,7 +430,7 @@ bool TImport_app::importa_fatture(const TFilename& fname, const TString& codnum,
|
||||
long codcf = 0;
|
||||
TString4 codpag;
|
||||
TString periodo;
|
||||
TToken_string ospiti(80, '@');
|
||||
TToken_string ospiti(256, '@');
|
||||
|
||||
TProgind pi(fat.items(), str);
|
||||
for (bool ok = fat.move_first(); ok && done; ok = fat.move_next())
|
||||
@ -430,9 +439,9 @@ bool TImport_app::importa_fatture(const TFilename& fname, const TString& codnum,
|
||||
if (!done)
|
||||
break;
|
||||
|
||||
const TString4 tipo = fat.get(8).as_string();
|
||||
const char tipo = fat.get(8).as_string()[0];
|
||||
|
||||
if (tipo == "T")
|
||||
if (tipo == 'T')
|
||||
{
|
||||
TString80 cofi_paiv = fat.get(14).as_string();
|
||||
cofi_paiv.trim(); cofi_paiv.upper();
|
||||
@ -454,7 +463,7 @@ bool TImport_app::importa_fatture(const TFilename& fname, const TString& codnum,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tipo != "N" || codcf <= 0)
|
||||
if (tipo != 'N' || codcf <= 0)
|
||||
continue; // Considera solo le righe articolo di clienti validi
|
||||
|
||||
const TDate datadoc = fat.get_date(5);
|
||||
@ -546,8 +555,16 @@ bool TImport_app::importa_fatture(const TFilename& fname, const TString& codnum,
|
||||
{
|
||||
TParagraph_string p(desc, 50);
|
||||
rdoc.put(RDOC_DESCR, p.get());
|
||||
rdoc.put(RDOC_DESCLUNGA, "X");
|
||||
rdoc.put(RDOC_DESCEST, p.get());
|
||||
const int sep = p.find(p.separator());
|
||||
if (sep > 0)
|
||||
{
|
||||
rdoc.put(RDOC_DESCLUNGA, "X");
|
||||
TString tmp = p.mid(sep+1);
|
||||
tmp.replace(p.separator(), ' ');
|
||||
tmp.strip_double_spaces();
|
||||
tmp.insert("\n");
|
||||
rdoc.put(RDOC_DESCEST, tmp);
|
||||
}
|
||||
}
|
||||
else
|
||||
rdoc.put(RDOC_DESCR, desc);
|
||||
|
266
ps/ps0430500.cpp
266
ps/ps0430500.cpp
@ -1,13 +1,19 @@
|
||||
#include <automask.h>
|
||||
#include <applicat.h>
|
||||
#include <progind.h>
|
||||
#include <recset.h>
|
||||
#include <reputils.h>
|
||||
|
||||
|
||||
#include "../cg/cg2101.h"
|
||||
#include "../cg/cglib01.h"
|
||||
#include "../cg/cglib02.h"
|
||||
#include "../mg/mglib.h"
|
||||
#include "ps0430500a.h"
|
||||
|
||||
#include "../ca/calib01.h"
|
||||
#include "../ca/commesse.h"
|
||||
#include "../ca/movana.h"
|
||||
#include "../ca/rmovana.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRimfin_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -32,11 +38,16 @@ bool TRimfin_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
||||
|
||||
class TRimfin_app : public TSkeleton_application
|
||||
{
|
||||
private:
|
||||
virtual const char* extra_modules() const { return "cg|cm|mg"; }
|
||||
|
||||
protected:
|
||||
virtual const char* extra_modules() const { return "ca"; }
|
||||
virtual void main_loop();
|
||||
void add_rmov(const TImporto& importo, const TString& codmag, const TCausale& caus, TMovimentoPN& mov) const;
|
||||
void create_mov(const TString& codcaus, const TDate& datareg, TString_array& saldi, TLog_report& log) const;
|
||||
void create_movana(const TRectype& movhead, TString_array& a, TLog_report& log) const;
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
static bool scan_mag(const TRelation& rel, void* jolly)
|
||||
@ -47,6 +58,10 @@ static bool scan_mag(const TRelation& rel, void* jolly)
|
||||
if (qta.sign() <= 0)
|
||||
return true;
|
||||
|
||||
TString16 key = rec.get("CODTAB").left(3);
|
||||
if (cache().get("MAG", key).empty())
|
||||
return true; // Ignora magazzini inesistenti
|
||||
|
||||
const TDate data = rec.get("D0");
|
||||
const TString& codart = rec.get("CODTAB").mid(5, 20);
|
||||
const TArticolo_giacenza& art = cached_article_balances(codart);
|
||||
@ -55,14 +70,8 @@ static bool scan_mag(const TRelation& rel, void* jolly)
|
||||
return true;
|
||||
|
||||
TBill bill;
|
||||
bill.set(rec.get_int("I3"), rec.get_int("I4"), rec.get_long("I5"));
|
||||
#ifdef DBG
|
||||
if (!bill.ok())
|
||||
bill.set(rec.get_int("I0"), rec.get_int("I1"), rec.get_long("I2"));
|
||||
#endif
|
||||
|
||||
TString16 key;
|
||||
key << rec.get("CODTAB").left(3) << '|' << bill.string(0x10);
|
||||
bill.set(rec.get_int("I0"), rec.get_int("I1"), rec.get_long("I2"));
|
||||
key << '|' << bill.string();
|
||||
|
||||
TAssoc_array& saldi = *(TAssoc_array*)jolly;
|
||||
real* imp = (real*)saldi.objptr(key);
|
||||
@ -75,6 +84,192 @@ static bool scan_mag(const TRelation& rel, void* jolly)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TRimfin_app::add_rmov(const TImporto& importo, const TString& codmag, const TCausale& caus, TMovimentoPN& mov) const
|
||||
{
|
||||
if (!importo.is_zero() && codmag.full())
|
||||
{
|
||||
TRectype& rmv = mov.cg(mov.cg_items());
|
||||
rmv.put(RMV_SEZIONE, importo.sezione());
|
||||
rmv.put(RMV_IMPORTO, importo.valore());
|
||||
rmv.put(RMV_DESCR, cache().get("MAG", codmag, "S0"));
|
||||
|
||||
TString80 cms = codmag; cms.right_just(20, '0');
|
||||
const TString& conto = cache().get(LF_COMMESSE, cms, COMMESSE_CODCONTO);
|
||||
if (conto.full())
|
||||
{
|
||||
rmv.put(RMV_GRUPPO, conto.mid(0, 3));
|
||||
rmv.put(RMV_CONTO, conto.mid(3, 3));
|
||||
rmv.put(RMV_SOTTOCONTO, conto.mid(6, 6));
|
||||
}
|
||||
else
|
||||
{
|
||||
TBill b; caus.bill(2, b);
|
||||
b.put(rmv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TRimfin_app::create_mov(const TString& codcaus, const TDate& datareg, TString_array& a, TLog_report& log) const
|
||||
{
|
||||
const TCausale caus(codcaus);
|
||||
TEsercizi_contabili esercizi;
|
||||
|
||||
TMovimentoPN mov;
|
||||
TRectype& head = mov.curr();
|
||||
|
||||
head.put(MOV_DATAREG, datareg);
|
||||
head.put(MOV_DATACOMP, datareg);
|
||||
head.put(MOV_CODCAUS, codcaus);
|
||||
head.put(MOV_DESCR, caus.descrizione());
|
||||
head.put(MOV_ANNOIVA, datareg.year());
|
||||
head.put(MOV_ANNOES, esercizi.date2esc(datareg));
|
||||
|
||||
TString4 curmag;
|
||||
TImporto tot;
|
||||
TBill bill; caus.bill(1, bill);
|
||||
|
||||
TString msg;
|
||||
|
||||
if (bill.conto() <= 0)
|
||||
{
|
||||
msg.format("Non esiste il conto sulla prima riga della causale %s", (const char*)codcaus);
|
||||
log.log(2, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
FOR_EACH_ARRAY_ROW(a, i, r)
|
||||
{
|
||||
const TString4 codmag = r->get(0);
|
||||
if (codmag != curmag)
|
||||
{
|
||||
tot.normalize();
|
||||
add_rmov(tot, curmag, caus, mov);
|
||||
curmag = codmag;
|
||||
tot.reset();
|
||||
}
|
||||
|
||||
const long sottoc = r->get_long(3);
|
||||
bill.set(bill.gruppo(), bill.conto(), sottoc);
|
||||
if (!bill.find())
|
||||
{
|
||||
msg.format("Non esiste il conto %d.%d.%ld", bill.gruppo(), bill.conto(), bill.sottoconto());
|
||||
log.log(1, msg);
|
||||
continue;
|
||||
}
|
||||
TRectype& rmv = mov.cg(mov.cg_items());
|
||||
bill.put(rmv);
|
||||
|
||||
TImporto importo(caus.sezione(1), real(r->get(4)));
|
||||
importo.normalize();
|
||||
rmv.put(RMV_SEZIONE, importo.sezione());
|
||||
rmv.put(RMV_IMPORTO, importo.valore());
|
||||
|
||||
tot -= importo;
|
||||
}
|
||||
tot.normalize();
|
||||
add_rmov(tot, curmag, caus, mov);
|
||||
|
||||
if (mov.cg_items() >= 2)
|
||||
{
|
||||
const int err = mov.write();
|
||||
if (err == NOERR)
|
||||
{
|
||||
TSaldo_agg saldo;
|
||||
saldo.set_anno_es(head.get_int(MOV_ANNOES));
|
||||
saldo.set_data_ulmov(datareg);
|
||||
saldo.set_movimentato(true);
|
||||
saldo.set_movprovv(false);
|
||||
saldo.set_tipo_saldo(normale);
|
||||
for (int i = 0; i < mov.cg_items(); i++)
|
||||
saldo.aggiorna(mov.cg(i));
|
||||
saldo.registra();
|
||||
|
||||
mov.last();
|
||||
|
||||
msg.format(FR("E' stato creato il movimento contabile %ld"), head.get_long(MOV_NUMREG));
|
||||
log.log(0, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.format(FR("Errore %d in creazione del movimento contabile"), err);
|
||||
log.log(2, msg);
|
||||
}
|
||||
}
|
||||
|
||||
create_movana(head, a, log);
|
||||
}
|
||||
|
||||
void TRimfin_app::create_movana(const TRectype& movhead, TString_array& a, TLog_report& log) const
|
||||
{
|
||||
const TString4 codcaus = movhead.get(MOV_CODCAUS);
|
||||
const TCausale caus(codcaus);
|
||||
|
||||
TAnal_mov mov;
|
||||
mov.put(MOVANA_DATAREG, movhead.get(MOV_DATAREG));
|
||||
mov.put(MOVANA_DATACOMP, movhead.get(MOV_DATACOMP));
|
||||
mov.put(MOVANA_DATADOC, movhead.get(MOV_DATADOC));
|
||||
mov.put(MOVANA_CODCAUS, codcaus);
|
||||
mov.put(MOVANA_ANNOES, movhead.get(MOV_ANNOES));
|
||||
mov.put(MOVANA_NUMREGCG, movhead.get(MOV_NUMREG));
|
||||
mov.put(MOVANA_DESCR, movhead.get(MOV_DESCR));
|
||||
|
||||
TImporto totdoc;
|
||||
TRectype rmv(LF_RMOVANA);
|
||||
TString80 codcms;
|
||||
TString msg;
|
||||
|
||||
TBill bill; caus.bill(1, bill);
|
||||
if (bill.conto() <= 0)
|
||||
{
|
||||
msg.format("Non esiste il conto sulla prima riga della causale %s", (const char*)codcaus);
|
||||
log.log(2, msg);
|
||||
return;
|
||||
}
|
||||
|
||||
FOR_EACH_ARRAY_ROW(a, i, r)
|
||||
{
|
||||
const TString4 codmag = r->get(0);
|
||||
codcms = codmag; codcms.right_just(20, '0');
|
||||
|
||||
TImporto importo(caus.sezione(1), real(r->get(4)));
|
||||
importo.normalize();
|
||||
rmv.put(RMOVANA_NUMRIG, i+1);
|
||||
rmv.put(RMOVANA_SEZIONE, importo.sezione());
|
||||
rmv.put(RMOVANA_IMPORTO, importo.valore());
|
||||
rmv.put(RMOVANA_CODCMS, codcms);
|
||||
rmv.put(RMOVANA_DESCR, cache().get(LF_COMMESSE, codcms, COMMESSE_DESCRIZ));
|
||||
|
||||
totdoc += importo;
|
||||
|
||||
const long sottoc = r->get_long(3);
|
||||
bill.set(bill.gruppo(), bill.conto(), sottoc);
|
||||
rmv.put(RMOVANA_CODCONTO, bill.string(0x8));
|
||||
|
||||
mov.body(LF_RMOVANA).add_row(rmv);
|
||||
}
|
||||
|
||||
totdoc.normalize();
|
||||
mov.put(MOVANA_SEZIONE, totdoc.sezione());
|
||||
mov.put(MOVANA_TOTDOC, totdoc.valore());
|
||||
|
||||
TLocalisamfile movana(LF_MOVANA);
|
||||
const int err = mov.write(movana);
|
||||
|
||||
if (err == NOERR)
|
||||
{
|
||||
movana.last();
|
||||
msg.format(FR("E' stato creato il movimento analitico %ld"), movana.get_long(MOVANA_NUMREG));
|
||||
log.log(0, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.format(FR("Errore %d in creazione del movimento analitico"), err);
|
||||
log.log(2, msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TRimfin_app::main_loop()
|
||||
{
|
||||
@ -82,37 +277,46 @@ void TRimfin_app::main_loop()
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
TString query;
|
||||
query << "USE &MGMAG"; // SELECT I5>0"
|
||||
query << "USE &MGMAG SELECT I2>0";
|
||||
TISAM_recordset recset(query);
|
||||
|
||||
TAssoc_array saldi;
|
||||
recset.cursor()->scan(scan_mag, &saldi, title());
|
||||
|
||||
TString_array a;
|
||||
FOR_EACH_ASSOC_OBJECT(saldi, h, k, o)
|
||||
if (!saldi.empty())
|
||||
{
|
||||
const TFixed_string key(k);
|
||||
TToken_string* r = new TToken_string;
|
||||
*r = key.left(3);
|
||||
r->add(key.mid(3));
|
||||
r->add(((real*)o)->string(0, 2));
|
||||
}
|
||||
a.sort();
|
||||
TString_array a;
|
||||
FOR_EACH_ASSOC_OBJECT(saldi, h, k, o)
|
||||
{
|
||||
TToken_string* r = new TToken_string(k);
|
||||
r->add(((real*)o)->string(0, 2));
|
||||
a.add(r);
|
||||
}
|
||||
a.sort();
|
||||
|
||||
TMovimentoPN mov;
|
||||
mov.curr().put(MOV_DATAREG, m.get(F_DATAREG));
|
||||
mov.curr().put(MOV_CODCAUS, m.get(F_CODCAUS));
|
||||
TString4 curmag;
|
||||
real imp;
|
||||
FOR_EACH_ARRAY_ROW(a, i, r)
|
||||
{
|
||||
TLog_report log; log.kill_duplicates();
|
||||
|
||||
log.log(0, "Rimanenze finali");
|
||||
const TDate data_fin = m.get(F_DATAREG_FIN);
|
||||
const TString& caus_fin = m.get(F_CODCAUS_FIN);
|
||||
create_mov(caus_fin, data_fin, a, log);
|
||||
|
||||
log.log(0, "");
|
||||
log.log(0, "Rimanenze iniziali");
|
||||
const TDate data_ini = m.get(F_DATAREG_INI);
|
||||
const TString& caus_ini = m.get(F_CODCAUS_INI);
|
||||
create_mov(caus_ini, data_ini, a, log);
|
||||
|
||||
log.preview();
|
||||
}
|
||||
else
|
||||
warning_box(TR("Non esistono giacenze di articoli con conto acquisti"));
|
||||
}
|
||||
}
|
||||
|
||||
int ps0430500(int argc, char* argv[])
|
||||
{
|
||||
TRimfin_app a;
|
||||
a.run(argc, argv, TR("Generazione rimanenze finali"));
|
||||
a.run(argc, argv, TR("Generazione rimanenze"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
#define F_DATAREG 101
|
||||
#define F_CODCAUS 102
|
||||
#define F_DESCAUS 103
|
||||
#define F_DATAREG_FIN 101
|
||||
#define F_CODCAUS_FIN 102
|
||||
#define F_DESCAUS_FIN 103
|
||||
|
||||
#define F_DATAREG_INI 111
|
||||
#define F_CODCAUS_INI 112
|
||||
#define F_DESCAUS_INI 113
|
||||
|
@ -1,38 +1,79 @@
|
||||
#include "ps0430500a.h"
|
||||
|
||||
PAGE "Generazione rimanenze finali" -1 -1 63 5
|
||||
PAGE "Generazione rimanenze finali" -1 -1 60 9
|
||||
|
||||
DATE F_DATAREG
|
||||
GROUPBOX DLG_NULL 56 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "Data "
|
||||
PROMPT 1 1 "@bRimanenze finali"
|
||||
END
|
||||
|
||||
STRING F_CODCAUS_FIN 3
|
||||
BEGIN
|
||||
PROMPT 2 2 "Causale "
|
||||
USE LF_CAUSALI SELECT (REG="")&&(TIPOMOV="")&&(MOVAP="")&&(MOVIND!="")
|
||||
INPUT CODCAUS F_CODCAUS_FIN
|
||||
DISPLAY "Codice" CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_CODCAUS_FIN CODCAUS
|
||||
OUTPUT F_DESCAUS_FIN DESCR
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCAUS_FIN 50
|
||||
BEGIN
|
||||
PROMPT 2 3 ""
|
||||
USE LF_CAUSALI KEY 2 SELECT (REG="")&&(TIPOMOV="")&&(MOVAP="")&&(MOVIND!="")
|
||||
INPUT CODCAUS F_CODCAUS_FIN
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Codice" CODCAUS
|
||||
COPY OUTPUT F_CODCAUS_FIN
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_DATAREG_FIN
|
||||
BEGIN
|
||||
PROMPT 37 2 "Data "
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 56 4
|
||||
BEGIN
|
||||
PROMPT 1 5 "@bRimanenze iniziali"
|
||||
END
|
||||
|
||||
STRING F_CODCAUS_INI 3
|
||||
BEGIN
|
||||
PROMPT 2 6 "Causale "
|
||||
COPY USE F_CODCAUS_FIN
|
||||
INPUT CODCAUS F_CODCAUS_INI
|
||||
COPY DISPLAY F_CODCAUS_FIN
|
||||
OUTPUT F_CODCAUS_INI CODCAUS
|
||||
OUTPUT F_DESCAUS_INI DESCR
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCAUS_INI 50
|
||||
BEGIN
|
||||
PROMPT 2 7 ""
|
||||
COPY USE F_DESCAUS_FIN
|
||||
INPUT CODCAUS F_CODCAUS_INI
|
||||
COPY DISPLAY F_DESCAUS_FIN
|
||||
COPY OUTPUT F_CODCAUS_INI
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_DATAREG_INI
|
||||
BEGIN
|
||||
PROMPT 37 6 "Data "
|
||||
FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_CODCAUS 3
|
||||
BEGIN
|
||||
PROMPT 1 2 "Causale "
|
||||
USE LF_CAUSALI SELECT (REG="")&&(TIPOMOV="")&&(MOVAP="")&&(MOVIND!="")
|
||||
INPUT CODCAUS F_CODCAUS
|
||||
DISPLAY "Codice" CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_CODCAUS CODCAUS
|
||||
OUTPUT F_DESCAUS DESCR
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DESCAUS 50
|
||||
BEGIN
|
||||
PROMPT 9 3 ""
|
||||
USE LF_CAUSALI KEY 2 SELECT (REG="")&&(TIPOMOV="")&&(MOVAP="")&&(MOVIND!="")
|
||||
INPUT CODCAUS F_CODCAUS
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
DISPLAY "Codice" CODCAUS
|
||||
COPY OUTPUT F_CODCAUS
|
||||
ADD RUN cg0 -4
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING DLG_PROFILE 256 50
|
||||
BEGIN
|
||||
@ -44,7 +85,16 @@ END
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
|
||||
BUTTON DLG_SAVEREC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Ricalcola"
|
||||
PICTURE TOOL_SAVEREC
|
||||
MESSAGE RUN,mg1,-2
|
||||
END
|
||||
|
||||
#include <elabar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -9,7 +9,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
case 0:
|
||||
default:
|
||||
ps0925100(argc, argv); break; //Stampa ordini di produzione DBService
|
||||
ps0925100(argc, argv); break; //Stampa estratti conto COSEA
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user