From 76de617a65e3cdb1bf46e9a18d0d068596f74cd0 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 6 Mar 2012 13:41:51 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : db1.exe db1100a.msk Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@22597 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- db/db1100.cpp | 116 +++++++++++++++++++++++++++++++++---------------- db/db1100a.h | 2 + db/db1100a.uml | 49 +++++++++++++++------ 3 files changed, 116 insertions(+), 51 deletions(-) diff --git a/db/db1100.cpp b/db/db1100.cpp index 5880133ef..895ce2d91 100755 --- a/db/db1100.cpp +++ b/db/db1100.cpp @@ -14,11 +14,9 @@ #include "../cg/cglib01.h" #include "../mg/mglib.h" #include "../ve/velib.h" - -#include "rdist.h" #include "dblib.h" -#include -#include + +#include "dist.h" #include "../mg/anamag.h" #include "db1100a.h" @@ -1701,53 +1699,64 @@ void TEsplosione_distinta_app::compile_list() c.setregion(from,to); const bool null_sel = _parameters._from_num.empty() || _parameters._to_num.empty(); const long items = null_sel ? 0L : c.items(); - TSheet_field& sa = (TSheet_field&) _mask->field(F_SHEETART); - const int righe = sa.items(); - TProgind p(items+righe,TR("Estrazione distinte da esplodere..."), TRUE, TRUE); - c.freeze(); - for (c = 0L; c.pos() < items; ++c) + if (items > 0) { - p.addstatus(1); - if (p.iscancelled()) - break; - if (doc.read(c.curr()) == NOERR) + TProgind p(items,TR("Estrazione distinte da esplodere da documenti...")); + c.freeze(); + for (c = 0L; c.pos() < items; ++c) { - const int rows = doc.rows(); - for (int i = 1; i <= rows; i++) + if (!p.addstatus(1)) + break; + if (doc.read(c.curr()) == NOERR) { - dist.put("CODDIST", doc[i].get(RDOC_CODART)); - if (doc[i].is_articolo() && dist.read() == NOERR) // Aggiunge le righe che sono solo effettivamente articoli di magazzino e distinte + const int rows = doc.rows(); + for (int i = 1; i <= rows; i++) { - TDist2Explode * de = new TDist2Explode; - de->set(doc[i], *_mask); - key = de->key(); - const bool is_key = _dist_list.is_key(key); - if (is_key) + dist.put("CODDIST", doc[i].get(RDOC_CODART)); + if (doc[i].is_articolo() && dist.read() == NOERR) // Aggiunge le righe che sono solo effettivamente articoli di magazzino e distinte { - TDist2Explode * dd = (TDist2Explode*)_dist_list.objptr(key); - // Check whether we've 2 convert in base UM... - if (de->acqven()) // Se acquisto sottrae... - de->qta() = dd->qta() - de->qta(); - else - de->qta() += dd->qta(); // altrimenti aggiunge + TDist2Explode * de = new TDist2Explode; + de->set(doc[i], *_mask); + key = de->key(); + const bool is_key = _dist_list.is_key(key); + if (is_key) + { + TDist2Explode * dd = (TDist2Explode*)_dist_list.objptr(key); + // Check whether we've 2 convert in base UM... + if (de->acqven()) // Se acquisto sottrae... + de->qta() = dd->qta() - de->qta(); + else + de->qta() += dd->qta(); // altrimenti aggiunge + } + _dist_list.add(key, de, TRUE); + if (de->qta() == ZERO) + _dist_list.remove(key); } - _dist_list.add(key, de, TRUE); - if (de->qta() == ZERO) - _dist_list.remove(key); } } } } - - // Aggiunge le righe dallo spreadsheet - for (int i = 0; i < righe; i++) + + if (_mask->get(F_DADIST).full() || _mask->get(F_ADIST).full()) { - p.addstatus(1L); - if (!sa.row(i).empty_items()) + TISAM_recordset dist("USE DIST\nFROM CODDIST=#DADIST\nTO CODDIST=#ADIST"); + dist.set_var("#DADIST", _mask->get(F_DADIST)); + dist.set_var("#ADIST", _mask->get(F_ADIST)); + + TProgind p(dist.items(), TR("Estrazione distinte...")); + TToken_string row; + for (bool ok = dist.move_first(); ok; ok = dist.move_next()) { - TDist2Explode * de = new TDist2Explode; - de->set(sa.row(i), *_mask); + if (!p.addstatus(1)) + break; + row = dist.get(DIST_CODDIST).as_string(); + row.add(dist.get(DIST_UM).as_string(), 9); + row.add(1); + row.add(TDate(TODAY)); + + TDist2Explode* de = new TDist2Explode; + de->set(row, *_mask); key = de->key(); const bool is_key = _dist_list.is_key(key); if (is_key) @@ -1762,6 +1771,37 @@ void TEsplosione_distinta_app::compile_list() _dist_list.add(key, de, TRUE); } } + + + // Aggiunge le righe dallo spreadsheet + TSheet_field& sa = _mask->sfield(F_SHEETART); + const int righe = sa.items(); + if (righe > 0) + { + TProgind p(righe,TR("Estrazione distinte da esplodere...")); + for (int i = 0; i < righe; i++) + { + if (!p.addstatus(1L)) + break; + if (!sa.row(i).empty_items()) + { + TDist2Explode * de = new TDist2Explode; + de->set(sa.row(i), *_mask); + key = de->key(); + const bool is_key = _dist_list.is_key(key); + if (is_key) + { + TDist2Explode * dd = (TDist2Explode*)_dist_list.objptr(key); + // Check 2 see whether we've 2 convert in base UM... + if (de->acqven()) // Se acquisto sottrae... + de->qta() = dd->qta() - de->qta(); + else + de->qta() += dd->qta(); // altrimenti aggiunge + } + _dist_list.add(key, de, TRUE); + } + } + } } void TEsplosione_distinta_app::compile_numeration_list() diff --git a/db/db1100a.h b/db/db1100a.h index fd4a02701..f59a746f3 100755 --- a/db/db1100a.h +++ b/db/db1100a.h @@ -51,6 +51,8 @@ #define F_DESCLIN 149 #define F_SORTFOR 150 #define F_ADVANCED_EXPL 151 +#define F_DADIST 152 +#define F_ADIST 153 #define F_CODDIS 101 #define F_LIV1 102 diff --git a/db/db1100a.uml b/db/db1100a.uml index 63075377e..40022e5bc 100755 --- a/db/db1100a.uml +++ b/db/db1100a.uml @@ -270,20 +270,20 @@ LIST F_GROUPMODE 1 53 BEGIN PROMPT 2 18 "Raggruppa " ITEM "0|Nessun raggruppamento" - ITEM "1|Raggruppa per unita' di misura" - ITEM "2|Converti nell'unita' principale" - ITEM "3|Raggruppa all'unita' di misura principale" - ITEM "4|Converti nell'unita' di misura di distinta" - ITEM "5|Raggruppa all'unita' di misura di distinta" + ITEM "1|Raggruppa per unitą di misura" + ITEM "2|Converti nell'unitą principale" + ITEM "3|Raggruppa all'unitą di misura principale" + ITEM "4|Converti nell'unitą di misura di distinta" + ITEM "5|Raggruppa all'unitą di misura di distinta" END ENDPAGE -PAGE "Disponibilita'" -1 -1 78 20 +PAGE "Disponibilitą" -1 -1 78 20 BOOLEAN F_FABBISOGNO BEGIN - PROMPT 2 1 "Calcola disponibilita'" + PROMPT 2 1 "Calcola disponibilitą" MESSAGE TRUE ENABLE,G_DISPONIB@ MESSAGE FALSE CLEAR,G_DISPONIB@ END @@ -360,7 +360,7 @@ LISTBOX F_VALORIZZAZIONE 32 BEGIN PROMPT 1 12 "" ITEM "0|Non valorizzare" - MESSAGE HIDE,G_LISTINO@|CLEAR,F_ADVANCED_EXPL + MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL ITEM "1|Valorizza Ultimo costo" MESSAGE HIDE,G_LISTINO@|ENABLE,F_ADVANCED_EXPL ITEM "2|Valorizza Costo medio" @@ -385,7 +385,7 @@ END BOOLEAN F_ADVANCED_EXPL BEGIN - PROMPT 38 12 "Dettagliata " + PROMPT 38 12 "Non Dett.Articoli d'acquisto" END STRING F_CODLIST 3 @@ -418,9 +418,10 @@ BEGIN OUTPUT F_CATVEN_LIST CODTAB GROUP G_LISTINO END + GROUPBOX DLG_NULL 50 6 BEGIN - PROMPT 2 13 "Disponibilita' & Valorizzazione" + PROMPT 2 13 "Disponibilitą & Valorizzazione" END STRING F_SLMAG 3 @@ -513,6 +514,28 @@ ENDPAGE PAGE "Articoli" -1 -1 78 20 +STRING F_DADIST 20 +BEGIN + PROMPT 1 1 "Esplosione dalla distinta " + USE LF_DIST + INPUT CODDIST F_DADIST + DISPLAY "Codice@20" CODDIST + DISPLAY "Descrizione@50" DESCR + DISPLAY "UM" UM + OUTPUT F_DADIST CODDIST + CHECKTYPE NORMAL +END + +STRING F_ADIST 20 +BEGIN + PROMPT 51 1 "alla " + COPY USE F_DADIST + INPUT CODDIST F_ADIST + COPY DISPLAY F_DADIST + OUTPUT F_ADIST CODDIST + CHECKTYPE NORMAL +END + SPREADSHEET F_SHEETART BEGIN PROMPT 2 2 "" @@ -666,12 +689,12 @@ END STRING F_UMEXPR 2 BEGIN - PROMPT 2 8 "Unita' di misura " + PROMPT 2 8 "Unitą di misura " USE LF_UMART KEY 2 SELECT CODART==#F_CODDIS JOIN LF_ANAMAG INTO CODART==CODART INPUT CODART F_CODDIS SELECT INPUT UM F_UMEXPR - DISPLAY "Unita'" UM + DISPLAY "Unitą" UM DISPLAY "Articolo@20" CODART DISPLAY "Descrizione Articolo@50" LF_ANAMAG->DESCR OUTPUT F_UMEXPR UM @@ -682,7 +705,7 @@ END NUMBER F_QTA 12 5 BEGIN - PROMPT 2 9 "Quantita' " + PROMPT 2 9 "Quantitą " CHECKTYPE REQUIRED END