Patch level :10.0
Files correlati :lv2.exe Ricompilazione Demo : [ ] Commento : aggiunta gestione prezzi filtri cliente sulla fatturazione git-svn-id: svn://10.65.10.50/trunk@18659 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									c23d8c8a2d
								
							
						
					
					
						commit
						ef0d3f189b
					
				
							
								
								
									
										107
									
								
								lv/lv2500.cpp
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								lv/lv2500.cpp
									
									
									
									
									
								
							| @ -4,8 +4,11 @@ | |||||||
| #include "lvlib.h" | #include "lvlib.h" | ||||||
| #include "lv2500a.h" | #include "lv2500a.h" | ||||||
| 
 | 
 | ||||||
|  | #include "cfven.h" | ||||||
| #include "lvcondv.h" | #include "lvcondv.h" | ||||||
| #include "lvrcondv.h" | #include "lvrcondv.h" | ||||||
|  | #include "rdoc.h" | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| #include "../ve/ve6200.h" | #include "../ve/ve6200.h" | ||||||
| #include "../ve/ve6200a.h" | #include "../ve/ve6200a.h" | ||||||
| @ -107,12 +110,11 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out) | |||||||
| 	for (int id = 0; id < doc_out.items(); id++) | 	for (int id = 0; id < doc_out.items(); id++) | ||||||
|   {                                              |   {                                              | ||||||
|     TDocumento& doc = doc_out[id]; |     TDocumento& doc = doc_out[id]; | ||||||
| 	  const int rows = doc.physical_rows(); |  | ||||||
| 		const long clifo = doc.get_long(DOC_CODCF); | 		const long clifo = doc.get_long(DOC_CODCF); | ||||||
| 		const int indsped = doc.get_int(DOC_CODINDSP); | 		const int indsped = doc.get_int(DOC_CODINDSP); | ||||||
| 		TLaundry_contract contr(clifo,indsped,_data_elab); | 		TLaundry_contract contr(clifo,indsped,_data_elab); | ||||||
|    |    | ||||||
| 		for (int i = 1; i <= rows; i++) | 		for (int i = 1; i <= doc.physical_rows(); i++) | ||||||
| 		{ | 		{ | ||||||
| 			TRiga_documento& rout = doc[i]; | 			TRiga_documento& rout = doc[i]; | ||||||
| 			const TString80 codart=rout.get(RDOC_CODART); | 			const TString80 codart=rout.get(RDOC_CODART); | ||||||
| @ -134,16 +136,13 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out) | |||||||
| 				case 0: | 				case 0: | ||||||
|   					break; |   					break; | ||||||
| 				case 1: | 				case 1: | ||||||
| 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZZO)); |  | ||||||
| 						break; |  | ||||||
| 				case 2: |  | ||||||
| 					{ | 					{ | ||||||
| 						rout.put(RDOC_QTA, UNO); | 						// rout.put(RDOC_QTA, UNO);
 | ||||||
| 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_IMPFISART)); | 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_IMPFISART)); | ||||||
| 						// gestione in base codice per valore fisso ??? tolta la scelta dell'articolo o del cliente
 | 						// gestione in base codice per valore fisso ??? tolta la scelta dell'articolo o del cliente
 | ||||||
| 					} | 					} | ||||||
| 					break; | 					break; | ||||||
| 				case 3: | 				case 2: | ||||||
| 					{ | 					{ | ||||||
| 						int tipolist=contr.get_int(LVCONDV_TIPOLIS); | 						int tipolist=contr.get_int(LVCONDV_TIPOLIS); | ||||||
| 
 | 
 | ||||||
| @ -155,32 +154,46 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out) | |||||||
| 							query << "USE UMART KEY 2 \n" | 							query << "USE UMART KEY 2 \n" | ||||||
| 										<< "FROM " << "CODART=#CODART UM=#UM \n" | 										<< "FROM " << "CODART=#CODART UM=#UM \n" | ||||||
| 										<< "TO "  << "TCODART=#CODART UM=#UM \n"; | 										<< "TO "  << "TCODART=#CODART UM=#UM \n"; | ||||||
| 	          |  | ||||||
|       				TISAM_recordset recset(query); |       				TISAM_recordset recset(query); | ||||||
| 							recset.set_var("#CODART",clifo); | 							recset.set_var("#CODART",clifo); | ||||||
| 							recset.set_var("#UM",rcont.get(LVRCONDV_UM)); | 							recset.set_var("#UM",rcont.get(LVRCONDV_UM)); | ||||||
| 
 |  | ||||||
| 							rout.put(RDOC_PREZZO,recset.get(UMART_PREZZO).as_real()); | 							rout.put(RDOC_PREZZO,recset.get(UMART_PREZZO).as_real()); | ||||||
| 						} | 						} | ||||||
| 
 |  | ||||||
| 						rout.put(RDOC_QTA, dot); | 						rout.put(RDOC_QTA, dot); | ||||||
| 					} | 					} | ||||||
| 					break; | 					break; | ||||||
| 				case 4: | 				case 3: | ||||||
| 					{ | 					{ | ||||||
| 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZZO)); |  | ||||||
| 						const real cicl=rcont.get_real(LVRCONDV_MINCIC)*dot; |  | ||||||
|             const real qta=rout.get(RDOC_QTA); |             const real qta=rout.get(RDOC_QTA); | ||||||
| 						rout.put(RDOC_QTA, cicl > qta ? cicl : qta);  |             const real consumo=qta * rout.get_real(RDOC_PREZZO); | ||||||
|  |             const real ciclaggio=dot * rcont.get_real(LVRCONDV_PREZZO) * rcont.get_real(LVRCONDV_MINCIC); | ||||||
|  | 						if (consumo<ciclaggio) | ||||||
|  |             { | ||||||
|  |               const bool cicl2rig=contr.get_bool(LVCONDV_CICLAGGIO); | ||||||
|  |               const real cicl=rcont.get_real(LVRCONDV_MINCIC)*dot; | ||||||
|  |               if (cicl2rig) | ||||||
|  |               { | ||||||
|  |                 TRiga_documento& congrow=doc.insert_row(++i, "01"); | ||||||
|  |                 doc.copy_data(congrow,rout); | ||||||
|  |                 congrow.put(RDOC_DESCR,"Pareggio minimo fatturabile"); | ||||||
|  |                 rout.put(RDOC_QTA, cicl-qta);  | ||||||
|  |                 congrow.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZZO)); | ||||||
|  |               } | ||||||
|  |               else | ||||||
|  |               { | ||||||
|  | 						    rout.put(RDOC_QTA, cicl);  | ||||||
|  |                 rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZZO)); | ||||||
|  |               } | ||||||
|  |             } | ||||||
| 					} | 					} | ||||||
| 					break; | 					break; | ||||||
| 				case 5: | 				case 4: | ||||||
| 					{ | 					{ | ||||||
| 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_VALCONV)); | 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_VALCONV)); | ||||||
| 						rout.put(RDOC_QTA, dot*rcont.get_real(LVRCONDV_FORFPERCL)); | 						rout.put(RDOC_QTA, dot*rcont.get_real(LVRCONDV_FORFPERCL)); | ||||||
| 					} | 					} | ||||||
| 					break; | 					break; | ||||||
| 				case 6: | 				case 5: | ||||||
| 					{ | 					{ | ||||||
| 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZZO)); | 						rout.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZZO)); | ||||||
| 
 | 
 | ||||||
| @ -196,7 +209,6 @@ void TFatturazione_lavanderie::post_process_output(TLista_documenti& doc_out) | |||||||
| }  | }  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| void TFatturazione_lavanderie::add_rows(TRiga_documento & rout, TRiga_documento & rin) | void TFatturazione_lavanderie::add_rows(TRiga_documento & rout, TRiga_documento & rin) | ||||||
| { | { | ||||||
|   /*const TString8 causale = rin.get(RDOC_CODAGG1);
 |   /*const TString8 causale = rin.get(RDOC_CODAGG1);
 | ||||||
| @ -268,6 +280,25 @@ void TFatturazione_lavanderie::create_row(TDocumento& doc_out, const TRiga_docum | |||||||
|   const TString80 codart=rin.get(RDOC_CODARTMAG); |   const TString80 codart=rin.get(RDOC_CODARTMAG); | ||||||
|   const real qta=rin.get_real(RDOC_QTA); |   const real qta=rin.get_real(RDOC_QTA); | ||||||
|   const real qta1=rin.get_real(RDOC_QTAGG1); |   const real qta1=rin.get_real(RDOC_QTAGG1); | ||||||
|  |   const TRectype & rcont=contr.row(codart); | ||||||
|  |   const int tipoprezzo=ini_get_int(CONFIG_DITTA, "lv", "TipoPr"); | ||||||
|  |   real prezzo=rin.get_real(RDOC_PREZZO); | ||||||
|  | 
 | ||||||
|  |   if (tipoprezzo == 0) | ||||||
|  |   { | ||||||
|  |     if (rcont.empty()) | ||||||
|  |     { | ||||||
|  |       TArticolo& art=cached_article(codart); | ||||||
|  |       const TString& um=rin.get(RDOC_UMQTA); | ||||||
|  |       const int index=art.find_um(um); | ||||||
|  |        | ||||||
|  |       if (index>=0) | ||||||
|  |         prezzo=art.um()[index].get_real(UMART_PREZZO); | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |       prezzo=rcont.get_real(LVRCONDV_PREZZO); | ||||||
|  |   } | ||||||
|        |        | ||||||
|   // Guardo se è una causale di rotto e se è abilitato nella testata del contratto la fatturazione dei rotti
 |   // Guardo se è una causale di rotto e se è abilitato nella testata del contratto la fatturazione dei rotti
 | ||||||
|   if (cau.get_bool("B3") && contr.get_int(LVCONDV_ADDCAPROT) && !qta1.is_zero())  |   if (cau.get_bool("B3") && contr.get_int(LVCONDV_ADDCAPROT) && !qta1.is_zero())  | ||||||
| @ -276,11 +307,17 @@ void TFatturazione_lavanderie::create_row(TDocumento& doc_out, const TRiga_docum | |||||||
|     rd.add(RDOC_QTA, qta1); |     rd.add(RDOC_QTA, qta1); | ||||||
|     rd.put(RDOC_PREZZO,contr.row(codart).get_real(LVRCONDV_PREZDAN)); |     rd.put(RDOC_PREZZO,contr.row(codart).get_real(LVRCONDV_PREZDAN)); | ||||||
|   } |   } | ||||||
|   if (cau.get_bool("B0")) // movimenta ritirato
 | 
 | ||||||
|  |   if (cau.get_bool("B0")  && !qta1.is_zero()) // movimenta ritirato
 | ||||||
|   { |   { | ||||||
|     const TCausale_magazzino& rit = cached_causale_magazzino(cau.get("S1")); |     const TCausale_magazzino& rit = cached_causale_magazzino(cau.get("S1")); | ||||||
|     TRiga_documento& rr=find_or_create_row(doc_out,rin,'R'); |     const real sgnrit = rit.sgn(s_consmese); | ||||||
| 	  rr.add(RDOC_QTA,rit.sgn(s_consmese) * qta1); |     if (!sgnrit.is_zero()) | ||||||
|  |     { | ||||||
|  |       TRiga_documento& rr=find_or_create_row(doc_out,rin,'C'); | ||||||
|  | 	    rr.add(RDOC_QTA,sgnrit * qta1); | ||||||
|  |       rr.put(RDOC_PREZZO,prezzo); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|   if (cau.get_bool("B1") && !qta.is_zero()) // movimenta consegnato
 |   if (cau.get_bool("B1") && !qta.is_zero()) // movimenta consegnato
 | ||||||
|   { |   { | ||||||
| @ -299,6 +336,7 @@ void TFatturazione_lavanderie::create_row(TDocumento& doc_out, const TRiga_docum | |||||||
|     { |     { | ||||||
|       TRiga_documento& rc=find_or_create_row(doc_out,rin,'I'); |       TRiga_documento& rc=find_or_create_row(doc_out,rin,'I'); | ||||||
|   	  rc.add(RDOC_QTA,sgndotin * qta); |   	  rc.add(RDOC_QTA,sgndotin * qta); | ||||||
|  |       rc.put(RDOC_PREZZO,prezzo); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const real sgncons=con.sgn(s_consmese); |     const real sgncons=con.sgn(s_consmese); | ||||||
| @ -306,6 +344,7 @@ void TFatturazione_lavanderie::create_row(TDocumento& doc_out, const TRiga_docum | |||||||
|     { |     { | ||||||
|       TRiga_documento& rc=find_or_create_row(doc_out,rin,'C'); |       TRiga_documento& rc=find_or_create_row(doc_out,rin,'C'); | ||||||
|   	  rc.add(RDOC_QTA,sgncons * qta); |   	  rc.add(RDOC_QTA,sgncons * qta); | ||||||
|  |       rc.put(RDOC_PREZZO,prezzo); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -348,13 +387,17 @@ protected: | |||||||
| void TFatturazione_lav_app::main_loop() | void TFatturazione_lav_app::main_loop() | ||||||
| { | { | ||||||
|   TFatturazione_msk msk; |   TFatturazione_msk msk; | ||||||
|  |   const TString4 mskzona=msk.get(F_CODZONA); | ||||||
|  |   const TString4 mskcat=(F_CODCATC); | ||||||
|  | 
 | ||||||
| 	TLocalisamfile doc(LF_DOC); | 	TLocalisamfile doc(LF_DOC); | ||||||
| 	TLocalisamfile rdoc(LF_RIGHEDOC); | 	TLocalisamfile rdoc(LF_RIGHEDOC); | ||||||
| 
 | 
 | ||||||
|   while (msk.run()!=K_QUIT) |   while (msk.run()!=K_QUIT) | ||||||
|   { |   { | ||||||
|     TString query; |     TString query; | ||||||
|     query << "USE DOC KEY 3 SELECT (TIPOCF==\"C\")&&(BETWEEN(DATADOC,#DADATA,#ADATA))&&(STATO==\"2\")&&(TIPODOC==\"B01\")\n" |     //&&(BETWEEN(DATADOC,#DADATA,#ADATA))&&(STATO==\"2\")&&(TIPODOC==\"B01\")
 | ||||||
|  |     query << "USE DOC KEY 3 SELECT (TIPOCF==\"C\")\n" | ||||||
|      			<< "BY TIPOCF CODCF DATADOC\n" |      			<< "BY TIPOCF CODCF DATADOC\n" | ||||||
|           << "FROM " << "DATADOC=#DADATA PROVV=D ANNO=#ANNO\n" |           << "FROM " << "DATADOC=#DADATA PROVV=D ANNO=#ANNO\n" | ||||||
|           << "TO "  << " DATADOC=#ADATA PROVV=D ANNO=#ANNO\n"; |           << "TO "  << " DATADOC=#ADATA PROVV=D ANNO=#ANNO\n"; | ||||||
| @ -405,7 +448,27 @@ void TFatturazione_lav_app::main_loop() | |||||||
|        lastcli = clifo; |        lastcli = clifo; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       if (elab.is_document_ok(recset.cursor()->curr())) |       TToken_string key; | ||||||
|  |       key.add('C'); | ||||||
|  |       key.add(clifo); | ||||||
|  |       const TRectype& clienti=cache().get(LF_CFVEN,key); | ||||||
|  |       bool cliok=elab.is_document_ok(recset.cursor()->curr()); | ||||||
|  |        | ||||||
|  |       if (cliok) | ||||||
|  |       { | ||||||
|  |         if (mskzona.full()) | ||||||
|  |         { | ||||||
|  |           const TString& codzona=clienti.get(CFV_CODZONA); | ||||||
|  |           cliok = (codzona==mskzona); | ||||||
|  |         } | ||||||
|  |         if (cliok && mskcat.full()) | ||||||
|  |         { | ||||||
|  |           const TString& codcat=clienti.get(CFV_CODCATC); | ||||||
|  |           cliok= (codcat==mskcat); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |                   | ||||||
|  |       if (cliok) | ||||||
|       { |       { | ||||||
|        indsped = recset.get(DOC_CODINDSP).as_int(); |        indsped = recset.get(DOC_CODINDSP).as_int(); | ||||||
|        TLaundry_contract contr(clifo, indsped, datafat); |        TLaundry_contract contr(clifo, indsped, datafat); | ||||||
|  | |||||||
| @ -10,13 +10,12 @@ PAGE "Fatturazione" -1 -1 40 5 | |||||||
| DATE F_DADATA | DATE F_DADATA | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 2 1 "Fattura dal " |   PROMPT 2 1 "Fattura dal " | ||||||
|   FLAGS "H" |  | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| DATE F_ADATA | DATE F_ADATA | ||||||
| BEGIN | BEGIN | ||||||
|   PROMPT 45 1 "al " |   PROMPT 45 1 "al " | ||||||
|   FLAGS "H" |   FLAGS "A" | ||||||
| END | END | ||||||
| 
 | 
 | ||||||
| DATE F_DATAFAT | DATE F_DATAFAT | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user