Personalizzazioni per Cigno
git-svn-id: svn://10.65.10.50/branches/R_10_00@22828 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a747ce0fca
commit
38d0373fb9
@ -27,9 +27,8 @@ public:
|
||||
virtual ~TImpClienti_mask(){};
|
||||
};
|
||||
|
||||
TImpClienti_mask::TImpClienti_mask() :TAutomask ("pd1579100a")
|
||||
{
|
||||
}
|
||||
TImpClienti_mask::TImpClienti_mask() : TAutomask ("pd1579100a")
|
||||
{ }
|
||||
|
||||
bool TImpClienti_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
|
@ -557,10 +557,9 @@ TRectype& TPE_mask::new_row_effetto(TDistinta& dist, char tipocf, long codcf, co
|
||||
{
|
||||
bool found = true;
|
||||
|
||||
if (main_app().has_module(CUAUT))
|
||||
if (main_app().has_module(CTAUT))
|
||||
{
|
||||
const TString & eff_cup = eff.get(EFF_CUP);
|
||||
|
||||
found = (cup == eff_cup) && (cig == eff.get(EFF_CIG));
|
||||
}
|
||||
if (found)
|
||||
|
@ -42,6 +42,7 @@ private:
|
||||
virtual const char* extra_modules() const { return "cg|cm|mg"; }
|
||||
|
||||
protected:
|
||||
const TString& mag2cms(const TString& codmag) const;
|
||||
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;
|
||||
@ -50,6 +51,11 @@ public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
struct TScan_info : public TAssoc_array
|
||||
{
|
||||
int _societa;
|
||||
};
|
||||
|
||||
static bool scan_mag(const TRelation& rel, void* jolly)
|
||||
{
|
||||
const TRectype& rec = rel.curr();
|
||||
@ -58,9 +64,15 @@ 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
|
||||
TString80 key = rec.get("CODTAB").left(3);
|
||||
const TRectype& tabmag = cache().get("MAG", key);
|
||||
const int societa = tabmag.get_int("I3");
|
||||
if (societa <= 0) // Magazzino anonimo
|
||||
return true;
|
||||
|
||||
TScan_info& saldi = *(TScan_info*)jolly;
|
||||
if (saldi._societa > 0 && societa != saldi._societa)
|
||||
return true; // Magazzino di altra societa
|
||||
|
||||
const TDate data = rec.get("D0");
|
||||
const TString& codart = rec.get("CODTAB").mid(5, 20);
|
||||
@ -73,7 +85,6 @@ static bool scan_mag(const TRelation& rel, void* jolly)
|
||||
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);
|
||||
if (imp == NULL)
|
||||
{
|
||||
@ -200,6 +211,19 @@ void TRimfin_app::create_mov(const TString& codcaus, const TDate& datareg, TStri
|
||||
create_movana(head, a, log);
|
||||
}
|
||||
|
||||
const TString& TRimfin_app::mag2cms(const TString& codmag) const
|
||||
{
|
||||
TString query;
|
||||
query << "USE COMMESSE SELECT CODMAG=\"" << codmag << '"';
|
||||
TISAM_recordset cms(query);
|
||||
if (cms.move_first())
|
||||
return cms.get(COMMESSE_CODCMS).as_string();
|
||||
|
||||
TString& tmp = get_tmp_string(20);
|
||||
tmp = codmag; tmp.right_just(20, '0');
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void TRimfin_app::create_movana(const TRectype& movhead, TString_array& a, TLog_report& log) const
|
||||
{
|
||||
const TString4 codcaus = movhead.get(MOV_CODCAUS);
|
||||
@ -230,7 +254,7 @@ void TRimfin_app::create_movana(const TRectype& movhead, TString_array& a, TLog_
|
||||
FOR_EACH_ARRAY_ROW(a, i, r)
|
||||
{
|
||||
const TString4 codmag = r->get(0);
|
||||
codcms = codmag; codcms.right_just(20, '0');
|
||||
codcms = mag2cms(codmag);
|
||||
|
||||
TImporto importo(caus.sezione(1), real(r->get(4)));
|
||||
importo.normalize();
|
||||
@ -277,10 +301,11 @@ void TRimfin_app::main_loop()
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
TString query;
|
||||
query << "USE &MGMAG SELECT I2>0";
|
||||
query << "USE &MGMAG SELECT I0=50";
|
||||
TISAM_recordset recset(query);
|
||||
|
||||
TAssoc_array saldi;
|
||||
TScan_info saldi;
|
||||
saldi._societa = m.get_int(F_SOCIETA);
|
||||
recset.cursor()->scan(scan_mag, &saldi, title());
|
||||
if (!saldi.empty())
|
||||
{
|
||||
@ -295,13 +320,13 @@ void TRimfin_app::main_loop()
|
||||
|
||||
TLog_report log; log.kill_duplicates();
|
||||
|
||||
log.log(0, "Rimanenze finali");
|
||||
log.log(0, TR("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");
|
||||
log.log(0, TR("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);
|
||||
|
@ -5,3 +5,6 @@
|
||||
#define F_DATAREG_INI 111
|
||||
#define F_CODCAUS_INI 112
|
||||
#define F_DESCAUS_INI 113
|
||||
|
||||
#define F_SOCIETA 121
|
||||
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
PAGE "Generazione rimanenze finali" -1 -1 60 9
|
||||
|
||||
LIST F_SOCIETA 1 20
|
||||
BEGIN
|
||||
PROMPT 1 0 "Societŕ "
|
||||
ITEM "1|Il Cigno"
|
||||
ITEM "2|Team Service"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 56 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bRimanenze finali"
|
||||
|
Loading…
x
Reference in New Issue
Block a user