From 6f6006b9edfc812898d329a832dbfda09355721f Mon Sep 17 00:00:00 2001
From: alex <alex@c028cbd2-c16b-5b4b-a496-9718f37d4682>
Date: Wed, 16 Jan 2008 10:55:07 +0000
Subject: [PATCH] Patch level         : 4.0 nopatch Files correlati     : 
 pg0388.exe Ricompilazione Demo : [ ] Commento            :

De Cade'


git-svn-id: svn://10.65.10.50/trunk@15987 c028cbd2-c16b-5b4b-a496-9718f37d4682
---
 ps/pg0388200.cpp | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/ps/pg0388200.cpp b/ps/pg0388200.cpp
index 3b04d435e..b5ded94b5 100755
--- a/ps/pg0388200.cpp
+++ b/ps/pg0388200.cpp
@@ -13,6 +13,7 @@
 
 #include "pg0388200a.h"
 
+#include "../mg/mglib.h"
 #include "../ve/velib.h"
 #include "../sv/svlib09.h"
 #include "../mg/mag.h"
@@ -181,6 +182,7 @@ class TImpBol0388 : public TSkeleton_application
 	TString4 _numbol, _tipobol, _numord;
 	int  _statobol;
 	long _forbidden_ndoc, _lastbol;
+	TString8 _codmag, _codmag_st;
 
 	virtual const char * extra_modules() const {return "ba";}
 
@@ -272,6 +274,18 @@ void TImpBol0388::transfer_testata(const TRecord_text& curr, TLog_report& log)
   TDocumento& bol = _doc.doc(datadoc.year(), _numbol, num_bol);
   const bool isnew = bol.rows() == 0;
 
+	const TString8 causmag = TDocumento::tipo(_tipobol).caus_mov();
+	
+	_codmag = _codmag_st;
+	if (causmag.full())
+	{
+		TCausale_magazzino causale(causmag);
+		const TString & magdep = causale.default_magdep();
+		if (magdep.full())
+			_codmag = magdep;
+		bol.put(DOC_CAUSMAG, causmag);
+	}
+
 	if (isnew)
 	{
 		_forbidden_ndoc = 0L;
@@ -348,8 +362,8 @@ int TImpBol0388::crea_riga_bolla(const TRecord_text& curr, TDocumento& bol, bool
 	if (da_ordine)
 	{
 		const TRiga_documento& rdocord = ordine[nriga_ord];
-		da_ordine = rdocord.get(RDOC_CODART) == codart && 
-			          rdocord.get(RDOC_TIPORIGA) == rdoc.get(RDOC_TIPORIGA);
+		da_ordine = rdocord.get(RDOC_CODART) == codart;
+//			          rdocord.get(RDOC_TIPORIGA) == rdoc.get(RDOC_TIPORIGA);
 	}
 
 	//righe merce da ordine
@@ -372,6 +386,7 @@ int TImpBol0388::crea_riga_bolla(const TRecord_text& curr, TDocumento& bol, bool
 		const TString& um = rec_umart.get(UMART_UM);
 		rdoc.put(RDOC_UMQTA, um);
 		const real prezzo = rec_umart.get(UMART_PREZZO);
+		rdoc.put(RDOC_CODMAG, _codmag);
 		rdoc.put(RDOC_PREZZO, prezzo);
   	rdoc.put(RDOC_CODART, codart);
 	}
@@ -566,6 +581,11 @@ bool TImpBol0388::create()
   _configfile = new TConfig("pg0388conf.ini");
   _msk = new TImpBol0388_mask();
   open_files(LF_DOC, LF_RIGHEDOC, 0);       
+	TMagazzini mags;
+
+	_codmag_st = mags.standardmag();
+	_codmag_st.left_just(3);
+	_codmag_st << mags.standarddep();
   return TSkeleton_application::create();
 }