You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

675 lines
27 KiB

4 years ago
  1. #!/usr/bin/php
  2. <?php
  3. require_once "/var/www/html/prgdmug/F_DMUG.php";
  4. require_once "/var/www/html/prgdmug/inc/AppConfig.php";
  5. require_once "/var/www/html/prgdmug/inc/PostgreClass.php";
  6. require_once "/var/www/html/prgdmug/inc/ObtieneDatosPg.php";
  7. $salida = shell_exec( "/root/countphp.sh" );
  8. echo "Salida $salida\n";
  9. if( $salida >= 4 ){
  10. system( "/usr/bin/killall InterFactu.php" );
  11. }
  12. $fec = date('l jS \of F Y h:i:s A');
  13. echo "$fec:Inicia Proceso InterFactu ....\n";
  14. $server= "192.168.1.5";
  15. $port = 1030; //1030
  16. $hs = "DEMIURGO10-MCANET";
  17. $user = "general";
  18. $pass = "123456789";
  19. $pid = getmypid();
  20. $limit = 100;
  21. $veces_error_server = 0;
  22. $appConfig =& new AppConfig;
  23. /* Crea un objeto para el manejo postgres */
  24. $dataBD_PG =& $appConfig->BASE_DATOS_PG;
  25. $manejaBD_PG =& new PostgreClass($dataBD_PG["host"], $dataBD_PG["name"],
  26. $dataBD_PG["user"], $dataBD_PG["pass"]);
  27. $obtieneDatos_pg = & new ObtieneDatos_PG($appConfig, $manejaBD_PG);
  28. $pg_sql_factu = "SELECT * FROM forumvta.factu WHERE fac_trans = 0 AND (fac_tip = 'pv' OR fac_tip = 'pn' OR fac_tip = 'FC') AND fac_nexti > 0 LIMIT $limit";
  29. $v_FACTU = $obtieneDatos_pg->obtenerDatos($pg_sql_factu);
  30. $v_i=0;
  31. $control = count( $v_FACTU[0] );
  32. //echo "control = $control\n";//responde 101 campos si leyo OK
  33. if ( $control < 10 )
  34. {
  35. echo "NO HAY FACTURAS PARA TRANSFERIR\n";
  36. Finalizar();
  37. }
  38. for( $v_i=0 ; $v_FACTU[$v_i]['fac_nro'] ; $v_i++ )
  39. {
  40. $FAC_SUC = $v_FACTU[$v_i]['fac_suc'] ;
  41. $FAC_TIP = $v_FACTU[$v_i]['fac_tip'] ;
  42. $FAC_STIP= $v_FACTU[$v_i]['fac_stip'] ;
  43. $FAC_NRO = $v_FACTU[$v_i]['fac_nro'] ;
  44. $NROEXT = $v_FACTU[$v_i]['fac_nexti'];
  45. $fec = date('l jS \of F Y h:i:s A');
  46. echo "$fec .... FACTURA pos = $v_i sucu = $FAC_SUC tip=$FAC_TIP nro = $FAC_NRO NEXT = $NROEXT \n";
  47. $pg_sql_movi_fac = "SELECT * FROM forumvta.movi_fac ";
  48. $pg_sql_movi_fac .="WHERE mof_suc = $FAC_SUC AND mof_tip = '$FAC_TIP' ";
  49. $pg_sql_movi_fac .="AND mof_stip = $FAC_STIP AND mof_fac = $FAC_NRO ";
  50. //echo $pg_sql_movi_fac."\n";
  51. $v_MOVI_FAC = $obtieneDatos_pg->obtenerDatos( $pg_sql_movi_fac );
  52. $ConDMUG = new ConexDMUG( $server , $port , $hs ,$user , $pass );
  53. $ConDMUG->SetProgram( "Interfaz_FactuPG_Forum" );
  54. Carga_CABECERA( $ConDMUG , $v_FACTU , $v_i );
  55. $v_CantiDetalles = Carga_DETALLES( $ConDMUG , $v_MOVI_FAC );
  56. $ConDMUG->SetParameter( "CANTIDAD_CABECERAS" , 1 );
  57. $ConDMUG->SetParameter( "CANTIDAD_DETALLES" , $v_CantiDetalles );
  58. $ConDMUG->SetParameter( "FECHA_TRASMITE" , date() );
  59. $ConDMUG->SetParameter( "HORA_TRASMITE" , time() );
  60. if ( $ConDMUG->Execute_DMUG() < 0)
  61. {
  62. $fec = date('l jS \of F Y h:i:s A');
  63. echo "$fec : ERROR EN CONEXION CON SERVER , esperando 3 segundos para continuar ....\n";
  64. $veces_error_server++;
  65. if ( $veces_error_server > 2 )
  66. {
  67. $fec = date('l jS \of F Y h:i:s A');
  68. echo "$fec :FINALIZA POR ERROR DE CONEXION CON SERVER !!!!!!!!!!\n";
  69. Finalizar();
  70. }
  71. sleep(3);
  72. continue;
  73. }
  74. $RESULTADO = $ConDMUG->GetChild( "STRERROR" );
  75. echo "RESULTADO:".$RESULTADO."\n" ;
  76. echo "ERROR:".$ConDMUG->GetChild( "ERROR" )."\n" ;
  77. echo "INFORME :".$ConDMUG->GetChild( "INFO1" )."\n" ;
  78. echo "INFORME :".$ConDMUG->GetChild( "INFO2" )."\n" ;
  79. echo "PUTRECORD:".$ConDMUG->GetChild( "PUTRECORD" )."\n" ;
  80. echo "REGISTROS:".$ConDMUG->GetChild( "REGISTROS" )."\n" ;
  81. $ConDMUG->CloseConex();
  82. if ( $RESULTADO== "EXACTO" )
  83. {
  84. echo "Se marca FACTU $FAC_NRO en PG TRANS es 1 \n";
  85. Marca_CABECERA( $obtieneDatos_pg , $v_FACTU , $v_i );
  86. }
  87. else
  88. {
  89. echo "ERROR en $FAC_NRO \n";
  90. }
  91. unset($v_MOVI_FAC);
  92. echo "-------------------------------------------------------\n";
  93. sleep(1);
  94. }
  95. unset($v_FACTU);
  96. Finalizar();
  97. /***********************************************************************/
  98. function Finalizar()
  99. {
  100. system( "/bin/rm /tmp/InterFactu.blk" );
  101. exit();
  102. }
  103. /***********************************************************************/
  104. /*----------------------- function Carga_CABECERA ---------------------*/
  105. /***********************************************************************/
  106. function Carga_CABECERA( $ConDMUG , $p_FACTU , $v_i )
  107. {
  108. # define FACTU_FAC_SUC (dbfield) 0x0a01 /* Integer /
  109. $ConDMUG->SetParameter("FAC_SUC" , $p_FACTU[$v_i]['fac_suc'] );
  110. # define FACTU_FAC_TIP (dbfield) 0x0a02 /* String
  111. $ConDMUG->SetParameter("FAC_TIP" , $p_FACTU[$v_i]['fac_tip'] );
  112. # define FACTU_FAC_STIP (dbfield) 0x0a03 /* Integer
  113. $ConDMUG->SetParameter("FAC_STIP" , $p_FACTU[$v_i]['fac_stip'] );
  114. # define FACTU_FAC_NRO (dbfield) 0x0a04 /* Long
  115. $ConDMUG->SetParameter("FAC_NRO" , $p_FACTU[$v_i]['fac_nro'] );
  116. # define FACTU_FAC_FEC (dbfield) 0x0a05 /* Date /
  117. $ConDMUG->SetParameter("FAC_FEC" , $p_FACTU[$v_i]['fac_fec'] );
  118. # define FACTU_FAC_CLIE (dbfield) 0x0a06 /* Long /
  119. $ConDMUG->SetParameter("FAC_CLIE" , $p_FACTU[$v_i]['fac_clie'] );
  120. # define FACTU_FAC_FPED (dbfield) 0x0a07 /* Date /
  121. $ConDMUG->SetParameter("FAC_FPED" , $p_FACTU[$v_i]['fac_fped'] );
  122. # define FACTU_FAC_NREP (dbfield) 0x0a08 /* Long /
  123. $ConDMUG->SetParameter("FAC_NREP" , $p_FACTU[$v_i]['fac_nrep'] );
  124. # define FACTU_FAC_CPAG (dbfield) 0x0a09 /* Integer /
  125. $ConDMUG->SetParameter("FAC_CPAG" , $p_FACTU[$v_i]['fac_cpag'] );
  126. # define FACTU_FAC_IVA (dbfield) 0x0a0a /* Integer /
  127. $ConDMUG->SetParameter("FAC_IVA" , $p_FACTU[$v_i]['fac_iva'] );
  128. # define FACTU_FAC_CAJA (dbfield) 0x0a0b /* Integer /
  129. $ConDMUG->SetParameter("FAC_CAJA" , $p_FACTU[$v_i]['fac_caja'] );
  130. # define FACTU_FAC_CAJ (dbfield) 0x0a0c /* Integer /
  131. $ConDMUG->SetParameter("FAC_CAJ" , $p_FACTU[$v_i]['fac_caj'] );
  132. # define FACTU_FAC_FAC (dbfield) 0x0a0d /* Integer
  133. $ConDMUG->SetParameter("FAC_FAC" , $p_FACTU[$v_i]['fac_fac'] );
  134. # define FACTU_FAC_SEC (dbfield) 0x0a0e /* String /
  135. $ConDMUG->SetParameter("FAC_SEC" , $p_FACTU[$v_i]['fac_sec'] );
  136. # define FACTU_FAC_TVEN (dbfield) 0x0a0f /* String
  137. $ConDMUG->SetParameter("FAC_TVEN" , $p_FACTU[$v_i]['fac_tven'] );
  138. # define FACTU_FAC_COM (dbfield) 0x0a10 /* Long /
  139. $ConDMUG->SetParameter("FAC_COM" , $p_FACTU[$v_i]['fac_com'] );
  140. # define FACTU_FAC_TDEV (dbfield) 0x0a11 /* String
  141. $ConDMUG->SetParameter("FAC_TDEV" , $p_FACTU[$v_i]['fac_tdev'] );
  142. # define FACTU_FAC_SDEV (dbfield) 0x0a12 /* Integer
  143. $ConDMUG->SetParameter("FAC_SDEV" , $p_FACTU[$v_i]['fac_sdev'] );
  144. # define FACTU_FAC_NDEV (dbfield) 0x0a13 /* Long /
  145. $ConDMUG->SetParameter("FAC_NDEV" , $p_FACTU[$v_i]['fac_ndev'] );
  146. # define FACTU_FAC_FDEV (dbfield) 0x0a14 /* Date
  147. $ConDMUG->SetParameter("FAC_FDEV" , $p_FACTU[$v_i]['fac_fdev'] );
  148. # define FACTU_FAC_DES (dbfield) 0x0a15 /* Long /
  149. $ConDMUG->SetParameter("FAC_DES" , $p_FACTU[$v_i]['fac_des'] * 100 );
  150. # define FACTU_FAC_RECCP (dbfield) 0x0a16 /* Long /
  151. $ConDMUG->SetParameter("FAC_RECCP", $p_FACTU[$v_i]['fac_reccp'] * 100 );
  152. # define FACTU_FAC_RECVT (dbfield) 0x0a17 /* Long /
  153. $ConDMUG->SetParameter("FAC_RECVT", $p_FACTU[$v_i]['fac_recvt'] * 100 );
  154. # define FACTU_FAC_RECOF (dbfield) 0x0a18 /* Long /
  155. $ConDMUG->SetParameter("FAC_RECOF", $p_FACTU[$v_i]['fac_recof'] * 100 );
  156. # define FACTU_FAC_RECUN (dbfield) 0x0a19 /* Long /
  157. $ConDMUG->SetParameter("FAC_RECUN", $p_FACTU[$v_i]['fac_recun'] * 100 );
  158. # define FACTU_FAC_LIS (dbfield) 0x0a1a /* Integer
  159. $ConDMUG->SetParameter("FAC_LIS" , $p_FACTU[$v_i]['fac_lis'] );
  160. # define FACTU_FAC_TGRA (dbfield) 0x0a1b /* Float /
  161. $ConDMUG->SetParameter("FAC_TGRA" , $p_FACTU[$v_i]['fac_tgra'] * 100 );
  162. # define FACTU_FAC_TEIVA (dbfield) 0x0a1c /* Float /
  163. $ConDMUG->SetParameter("FAC_TEIVA", $p_FACTU[$v_i]['fac_teiva'] * 100 );
  164. # define FACTU_FAC_RPIE (dbfield) 0x0a1d /* Float /
  165. $ConDMUG->SetParameter("FAC_RPIE" , $p_FACTU[$v_i]['fac_rpie'] * 100 );
  166. # define FACTU_FAC_FLE (dbfield) 0x0a1e /* Integer /
  167. $ConDMUG->SetParameter("FAC_FLE" , $p_FACTU[$v_i]['fac_fle'] );
  168. # define FACTU_FAC_FLCA (dbfield) 0x0a1f /* Integer
  169. $ConDMUG->SetParameter("FAC_FLCA" , $p_FACTU[$v_i]['fac_flca'] );
  170. # define FACTU_FAC_FLET (dbfield) 0x0a20 /* Long
  171. $ConDMUG->SetParameter("FAC_FLET" , $p_FACTU[$v_i]['fac_flet'] );
  172. # define FACTU_FAC_FLPO (dbfield) 0x0a21 /* Long /
  173. $ConDMUG->SetParameter("FAC_FLPO" , $p_FACTU[$v_i]['fac_flpo'] * 100 );
  174. # define FACTU_FAC_IFLE (dbfield) 0x0a22 /* Float
  175. $ConDMUG->SetParameter("FAC_IFLE" , $p_FACTU[$v_i]['fac_ifle'] * 100 );
  176. # define FACTU_FAC_TIVA (dbfield) 0x0a23 /* Float/
  177. $ConDMUG->SetParameter("FAC_TIVA" , $p_FACTU[$v_i]['fac_tiva'] * 100 );
  178. # define FACTU_FAC_TNIVA (dbfield) 0x0a24 /* Float
  179. $ConDMUG->SetParameter("FAC_TNIVA", $p_FACTU[$v_i]['fac_tniva'] * 100 );
  180. # define FACTU_FAC_TIVAP (dbfield) 0x0a25 /* Float
  181. $ConDMUG->SetParameter("FAC_TIVAP", $p_FACTU[$v_i]['fac_tivap'] * 100 );
  182. # define FACTU_FAC_TIINT (dbfield) 0x0a26 /* Float
  183. $ConDMUG->SetParameter("FAC_TIINT", $p_FACTU[$v_i]['fac_tiint'] * 100 );
  184. # define FACTU_FAC_TABAS (dbfield) 0x0a27 /* Float
  185. $ConDMUG->SetParameter("FAC_TABAS", $p_FACTU[$v_i]['fac_tabas'] * 100 );
  186. # define FACTU_FAC_IPOL (dbfield) 0x0a28 /* Float
  187. $ConDMUG->SetParameter("FAC_IPOL" , $p_FACTU[$v_i]['fac_ipol'] );
  188. # define FACTU_FAC_INGB (dbfield) 0x0a29 /* Float
  189. $ConDMUG->SetParameter("FAC_INGB" , $p_FACTU[$v_i]['fac_ingb']* 100 );
  190. # define FACTU_FAC_PIBBS (dbfield) 0x0a2a /* Float
  191. $ConDMUG->SetParameter("FAC_PIBBS", $p_FACTU[$v_i]['fac_pibbs'] * 100 );
  192. # define FACTU_FAC_PIB14 (dbfield) 0x0a2b /* Float /
  193. $ConDMUG->SetParameter("FAC_PIB14", $p_FACTU[$v_i]['fac_pib14']* 100 );
  194. # define FACTU_FAC_ITOT (dbfield) 0x0a2c /* Float /
  195. $ConDMUG->SetParameter("FAC_ITOT" , $p_FACTU[$v_i]['fac_itot'] * 100 );
  196. # define FACTU_FAC_REC (dbfield) 0x0a2d /* Float /
  197. $ConDMUG->SetParameter("FAC_REC" , $p_FACTU[$v_i]['fac_rec'] * 100 );
  198. # define FACTU_FAC_ICOM (dbfield) 0x0a2e /* Float
  199. $ConDMUG->SetParameter("FAC_ICOM" , $p_FACTU[$v_i]['fac_icom']* 100 );
  200. # define FACTU_FAC_IMP (dbfield) 0x0a2f /* Integer
  201. $ConDMUG->SetParameter("FAC_IMP" , $p_FACTU[$v_i]['fac_imp'] );
  202. # define FACTU_FAC_ADM (dbfield) 0x0a30 /* Integer
  203. $ConDMUG->SetParameter("FAC_ADM" , $p_FACTU[$v_i]['fac_adm'] );
  204. # define FACTU_FAC_OBS (dbfield) 0x0a31 /* String
  205. $ConDMUG->SetParameter("FAC_OBS" , $p_FACTU[$v_i]['fac_obs'] );
  206. # define FACTU_FAC_CON1 (dbfield) 0x0a32 /* Integer
  207. $ConDMUG->SetParameter("FAC_CON1" , $p_FACTU[$v_i]['fac_con1'] );
  208. # define FACTU_FAC_CON2 (dbfield) 0x0a33 /* Integer
  209. $ConDMUG->SetParameter("FAC_CON2" , $p_FACTU[$v_i]['fac_con2'] );
  210. # define FACTU_FAC_IT (dbfield) 0x0a34 /* Integer /
  211. $ConDMUG->SetParameter("FAC_IT" , $p_FACTU[$v_i]['fac_it'] );
  212. # define FACTU_FAC_REVTA (dbfield) 0x0a35 /* Long /
  213. $ConDMUG->SetParameter("FAC_REVTA", $p_FACTU[$v_i]['fac_revta'] * 100 );
  214. # define FACTU_FAC_TRES (dbfield) 0x0a36 /* String /
  215. $ConDMUG->SetParameter("FAC_TRES" , $p_FACTU[$v_i]['fac_tres'] );
  216. # define FACTU_FAC_ORES (dbfield) 0x0a37 /* Integer
  217. $ConDMUG->SetParameter("FAC_ORES" , $p_FACTU[$v_i]['fac_ores'] );
  218. # define FACTU_FAC_NRES (dbfield) 0x0a38 /* Long /
  219. $ConDMUG->SetParameter("FAC_NRES" , $p_FACTU[$v_i]['fac_nres'] );
  220. # define FACTU_FAC_HORA (dbfield) 0x0a39 /* Time /
  221. $ConDMUG->SetParameter("FAC_HORA" , $p_FACTU[$v_i]['fac_hora'] );
  222. # define FACTU_FAC_DUP (dbfield) 0x0a3a /* Integer /
  223. $ConDMUG->SetParameter("FAC_DUP" , $p_FACTU[$v_i]['fac_dup'] );
  224. # define FACTU_FAC_FAF (dbfield) 0x0a3b /* Long /
  225. $ConDMUG->SetParameter("FAC_FAF" , $p_FACTU[$v_i]['fac_faf'] );
  226. # define FACTU_FAC_MOT (dbfield) 0x0a3c /* Integer /
  227. $ConDMUG->SetParameter("FAC_MOT" , $p_FACTU[$v_i]['fac_mot'] );
  228. # define FACTU_FAC_NOM (dbfield) 0x0a3d /* String /
  229. $ConDMUG->SetParameter("FAC_NOM" , $p_FACTU[$v_i]['fac_nom'] );
  230. # define FACTU_FAC_CPOS (dbfield) 0x0a3e /* Integer /
  231. $ConDMUG->SetParameter("FAC_CPOS" , $p_FACTU[$v_i]['fac_cpos'] );
  232. # define FACTU_FAC_CMP (dbfield) 0x0a3f /* String /
  233. $ConDMUG->SetParameter("FAC_CMP" , $p_FACTU[$v_i]['fac_cmp'] );
  234. # define FACTU_FAC_CAT (dbfield) 0x0a40 /* Integer /
  235. $ConDMUG->SetParameter("FAC_CAT" , $p_FACTU[$v_i]['fac_cat'] );
  236. # define FACTU_FAC_ZON (dbfield) 0x0a41 /* Integer /
  237. $ConDMUG->SetParameter("FAC_ZON" , $p_FACTU[$v_i]['fac_zon'] );
  238. # define FACTU_FAC_TVTA (dbfield) 0x0a42 /* String /
  239. $ConDMUG->SetParameter("FAC_TVTA" , $p_FACTU[$v_i]['fac_tvta'] );
  240. # define FACTU_FAC_TIPOP (dbfield) 0x0a43 /* String /
  241. $ConDMUG->SetParameter("FAC_TIPOP", $p_FACTU[$v_i]['fac_tipop'] );
  242. # define FACTU_FAC_FEXT (dbfield) 0x0a44 /* Date /
  243. $ConDMUG->SetParameter("FAC_FEXT" , $p_FACTU[$v_i]['fac_fext'] );
  244. # define FACTU_FAC_TEXT (dbfield) 0x0a45 /* String /
  245. $ConDMUG->SetParameter("FAC_TEXT" , $p_FACTU[$v_i]['fac_text'] );
  246. # define FACTU_FAC_LEXT (dbfield) 0x0a46 /* Integer /
  247. $ConDMUG->SetParameter("FAC_LEXT" , $p_FACTU[$v_i]['fac_lext'] );
  248. # define FACTU_FAC_SEXT (dbfield) 0x0a47 /* String /
  249. $ConDMUG->SetParameter("FAC_SEXT" , $p_FACTU[$v_i]['fac_sext'] );
  250. # define FACTU_FAC_NEXTI (dbfield) 0x0a48 /* Long /
  251. $ConDMUG->SetParameter("FAC_NEXTI", $p_FACTU[$v_i]['fac_nexti'] );
  252. # define FACTU_FAC_NEXTF (dbfield) 0x0a49 /* Long /
  253. $ConDMUG->SetParameter("FAC_NEXTF", $p_FACTU[$v_i]['fac_nextf'] );
  254. # define FACTU_FAC_AFEST (dbfield) 0x0a4a /* Integer /
  255. $ConDMUG->SetParameter("FAC_AFEST", $p_FACTU[$v_i]['fac_afest'] );
  256. # define FACTU_FAC_ESTVT (dbfield) 0x0a4b /* Integer /
  257. $ConDMUG->SetParameter("FAC_ESTVT", $p_FACTU[$v_i]['fac_estvt'] );
  258. # define FACTU_FAC_ESTVC (dbfield) 0x0a4c /* Integer /
  259. $ConDMUG->SetParameter("FAC_ESTVC", $p_FACTU[$v_i]['fac_estvc'] );
  260. # define FACTU_FAC_ESTCT (dbfield) 0x0a4d /* Integer /
  261. $ConDMUG->SetParameter("FAC_ESTCT", $p_FACTU[$v_i]['fac_estct'] );
  262. # define FACTU_FAC_ESTCC (dbfield) 0x0a4e /* Integer /
  263. $ConDMUG->SetParameter("FAC_ESTCC", $p_FACTU[$v_i]['fac_estcc'] );
  264. # define FACTU_FAC_CODEST (dbfield) 0x0a4f /* String
  265. $ConDMUG->SetParameter("FAC_CODEST", $p_FACTU[$v_i]['fac_codest'] );
  266. # define FACTU_FAC_TCEST (dbfield) 0x0a50 /* String /
  267. $ConDMUG->SetParameter("FAC_TCEST" , $p_FACTU[$v_i]['fac_tcest'] );
  268. # define FACTU_FAC_MAFEST (dbfield) 0x0a51 /* String /
  269. $ConDMUG->SetParameter("FAC_MAFEST", $p_FACTU[$v_i]['fac_mafest'] );
  270. # define FACTU_FAC_REG (dbfield) 0x0a52 /* String /
  271. $ConDMUG->SetParameter("FAC_REG" , $p_FACTU[$v_i]['fac_reg'] );
  272. # define FACTU_FAC_LUGENT (dbfield) 0x0a53 /* Integer /
  273. $ConDMUG->SetParameter("FAC_LUGENT", $p_FACTU[$v_i]['fac_lugent'] );
  274. # define FACTU_FAC_NCAI (dbfield) 0x0a54 /* String /
  275. $ConDMUG->SetParameter("FAC_NCAI" , $p_FACTU[$v_i]['fac_ncai'] );
  276. # define FACTU_FAC_FVCAI (dbfield) 0x0a55 /* Date /
  277. $ConDMUG->SetParameter("FAC_FVCAI" , $p_FACTU[$v_i]['fac_fvcai'] );
  278. # define FACTU_FAC_CFIS (dbfield) 0x0a56 /* Integer /
  279. $ConDMUG->SetParameter("FAC_CFIS" , $p_FACTU[$v_i]['fac_cfis'] );
  280. # define FACTU_FAC_COSTO (dbfield) 0x0a57 /* Float /
  281. $ConDMUG->SetParameter("FAC_COSTO" , $p_FACTU[$v_i]['fac_costo'] * 100 );
  282. # define FACTU_FAC_AUXF (dbfield) 0x0a58 /* Integer /
  283. $ConDMUG->SetParameter("FAC_AUXF" , $p_FACTU[$v_i]['fac_auxf'] );
  284. # define FACTU_FAC_TIVAF (dbfield) 0x0a59 /* Float /
  285. $ConDMUG->SetParameter("FAC_TIVAF" , $p_FACTU[$v_i]['fac_tivaf'] * 100 );
  286. # define FACTU_FAC_TNIVAF (dbfield) 0x0a5a /* Float /
  287. $ConDMUG->SetParameter("FAC_TNIVAF", $p_FACTU[$v_i]['fac_tnivaf'] * 100 );
  288. # define FACTU_FAC_ENTIP (dbfield) 0x0a5b /* Long /
  289. $ConDMUG->SetParameter("FAC_ENTIP" , $p_FACTU[$v_i]['fac_entip'] );
  290. # define FACTU_FAC_TKGSN (dbfield) 0x0a5c /* Float/
  291. $ConDMUG->SetParameter("FAC_TKGSN" , $p_FACTU[$v_i]['fac_tkgsn'] * 1000 );
  292. # define FACTU_FAC_TXKG (dbfield) 0x0a5d /* Float/
  293. $ConDMUG->SetParameter("FAC_TXKG" , $p_FACTU[$v_i]['fac_txkg'] * 100 );
  294. # define FACTU_FAC_INC (dbfield) 0x0a5e /* Float
  295. $ConDMUG->SetParameter("FAC_INC" , $p_FACTU[$v_i]['fac_inc'] * 100 );
  296. # define FACTU_FAC_CNC (dbfield) 0x0a5f /* Integer /
  297. $ConDMUG->SetParameter("FAC_CNC" , $p_FACTU[$v_i]['fac_cnc'] );
  298. # define FACTU_FAC_EMP (dbfield) 0x0a60 /* Integer /
  299. $ConDMUG->SetParameter("FAC_EMP" , $p_FACTU[$v_i]['fac_emp'] );
  300. # define FACTU_FAC_CONSO (dbfield) 0x0a61 /* Long
  301. $ConDMUG->SetParameter("FAC_CONSO" , $p_FACTU[$v_i]['fac_conso'] );
  302. # define FACTU_FAC_OBSC (dbfield) 0x0a62 /* String /
  303. $ConDMUG->SetParameter("FAC_OBSC" , $p_FACTU[$v_i]['fac_obsc'] );
  304. # define FACTU_FAC_HPED (dbfield) 0x0a63 /* Time /
  305. $ConDMUG->SetParameter("FAC_HPED" , $p_FACTU[$v_i]['fac_hped'] );
  306. # define FACTU_FAC_CBUL (dbfield) 0x0a64 /* Integer /
  307. $ConDMUG->SetParameter("FAC_CBUL" , $p_FACTU[$v_i]['fac_cbul'] );
  308. # define FACTU_FAC_NREM (dbfield) 0x0a65 /* Long
  309. $ConDMUG->SetParameter("FAC_NREM" , $p_FACTU[$v_i]['fac_nrem'] );
  310. # define FACTU_FAC_CBAR (dbfield) 0x0a66 /* String
  311. $ConDMUG->SetParameter("FAC_CBAR" , $p_FACTU[$v_i]['fac_cbar'] );
  312. }
  313. /****************************************************************************************/
  314. /*--------------------------- function Carga_DETALLES ----------------------------------*/
  315. /****************************************************************************************/
  316. function Carga_DETALLES( $ConDMUG , $p_MOVI_FAC )
  317. {
  318. $v_i = 0 ;
  319. for( $v_i=0 ; $p_MOVI_FAC[$v_i]['mof_fac'] ; $v_i++ )
  320. {
  321. echo "--->DETALLE pos = $v_i FACTURA = ".$p_MOVI_FAC[$v_i]['mof_fac']." ART=".$p_MOVI_FAC[$v_i]['mof_art']."\n";
  322. # define MOVI_FAC_MOF_SUC (dbfield) 0x0b01 nteger
  323. $ConDMUG->SetParameter( "MOF_SUC" , $p_MOVI_FAC[$v_i]['mof_suc'] );
  324. # define MOVI_FAC_MOF_TIP (dbfield) 0x0b02 /* String
  325. $ConDMUG->SetParameter( "MOF_TIP" , $p_MOVI_FAC[$v_i]['mof_tip'] );
  326. # define MOVI_FAC_MOF_STIP (dbfield) 0x0b03 /* Integer
  327. $ConDMUG->SetParameter( "MOF_STIP" , $p_MOVI_FAC[$v_i]['mof_stip'] );
  328. # define MOVI_FAC_MOF_FAC (dbfield) 0x0b04 /* Long
  329. $ConDMUG->SetParameter( "MOF_FAC" , $p_MOVI_FAC[$v_i]['mof_fac'] );
  330. # define MOVI_FAC_MOF_ART (dbfield) 0x0b05 /* Long
  331. $ConDMUG->SetParameter( "MOF_ART" , $p_MOVI_FAC[$v_i]['mof_art'] );
  332. # define MOVI_FAC_MOF_ITE (dbfield) 0x0b06 /* Integer
  333. $ConDMUG->SetParameter( "MOF_ITE" , $p_MOVI_FAC[$v_i]['mof_ite'] );
  334. # define MOVI_FAC_MOF_DEV (dbfield) 0x0b07 /* Integer
  335. $ConDMUG->SetParameter( "MOF_DEV" , $p_MOVI_FAC[$v_i]['mof_dev'] );
  336. # define MOVI_FAC_MOF_PREC (dbfield) 0x0b08 /* Long
  337. $ConDMUG->SetParameter( "MOF_PREC" , $p_MOVI_FAC[$v_i]['mof_prec'] * 10000 );
  338. # define MOVI_FAC_MOF_COST (dbfield) 0x0b09 /* Long
  339. $ConDMUG->SetParameter( "MOF_COST" , $p_MOVI_FAC[$v_i]['mof_cost'] * 10000);
  340. # define MOVI_FAC_MOF_CANT (dbfield) 0x0b0a /* Long
  341. $ConDMUG->SetParameter( "MOF_CANT" , $p_MOVI_FAC[$v_i]['mof_cant'] * 10000);
  342. # define MOVI_FAC_MOF_UDAD (dbfield) 0x0b0b /* String
  343. $ConDMUG->SetParameter( "MOF_UDAD" , $p_MOVI_FAC[$v_i]['mof_udad'] );
  344. # define MOVI_FAC_MOF_IABA (dbfield) 0x0b0/* Long
  345. $ConDMUG->SetParameter( "MOF_IABA" ,$p_MOVI_FAC[$v_i]['mof_iaba'] * 10000 );
  346. # define MOVI_FAC_MOF_IINT (dbfield) 0x0b0d /* Long
  347. $ConDMUG->SetParameter( "MOF_IINT" , $p_MOVI_FAC[$v_i]['mof_iint'] * 10000 );
  348. # define MOVI_FAC_MOF_OFE (dbfield) 0x0b0e /* Integer
  349. $ConDMUG->SetParameter( "MOF_OFE" ,$p_MOVI_FAC[$v_i]['mof_ofe'] );
  350. # define MOVI_FAC_MOF_DIG (dbfield) 0x0b0f /* Integer
  351. $ConDMUG->SetParameter( "MOF_DIG" ,$p_MOVI_FAC[$v_i]['mof_dig'] );
  352. # define MOVI_FAC_MOF_SCAN (dbfield) 0x0b10 /* Long
  353. $ConDMUG->SetParameter( "MOF_SCAN" , $p_MOVI_FAC[$v_i]['mof_scan'] );
  354. # define MOVI_FAC_MOF_CPIE (dbfield) 0x0b11 /* Long
  355. $ConDMUG->SetParameter( "MOF_CPIE" ,$p_MOVI_FAC[$v_i]['mof_cpie'] );
  356. # define MOVI_FAC_MOF_MVT (dbfield) 0x0b12 /* Integer
  357. $ConDMUG->SetParameter( "MOF_MVT" , $p_MOVI_FAC[$v_i]['mof_mvt'] );
  358. # define MOVI_FAC_MOF_IVA1 (dbfield) 0x0b13 /* Float
  359. $ConDMUG->SetParameter( "MOF_IVA1" , $p_MOVI_FAC[$v_i]['mof_iva1'] * 1000);
  360. # define MOVI_FAC_MOF_IVA2 (dbfield) 0x0b14 /* Float
  361. $ConDMUG->SetParameter( "MOF_IVA2" , $p_MOVI_FAC[$v_i]['mof_iva2'] * 1000 );
  362. # define MOVI_FAC_MOF_IVA3 (dbfield) 0x0b15 /* Float
  363. $ConDMUG->SetParameter( "MOF_IVA3" , $p_MOVI_FAC[$v_i]['mof_iva3'] * 1000 );
  364. # define MOVI_FAC_MOF_IVA4 (dbfield) 0x0b16 /* Float
  365. $ConDMUG->SetParameter( "MOF_IVA4" , $p_MOVI_FAC[$v_i]['mof_iva4'] * 1000 );
  366. # define MOVI_FAC_MOF_TAS1 (dbfield) 0x0b17 /* Long
  367. $ConDMUG->SetParameter( "MOF_TAS1" , $p_MOVI_FAC[$v_i]['mof_tas1'] * 1000);
  368. # define MOVI_FAC_MOF_TAS2 (dbfield) 0x0b18 /* Long
  369. $ConDMUG->SetParameter( "MOF_TAS2" , $p_MOVI_FAC[$v_i]['mof_tas2'] * 1000);
  370. # define MOVI_FAC_MOF_TAS3 (dbfield) 0x0b19 /* Long
  371. $ConDMUG->SetParameter( "MOF_TAS3" , $p_MOVI_FAC[$v_i]['mof_tas3'] * 1000);
  372. # define MOVI_FAC_MOF_TAS4 (dbfield) 0x0b1a /* Long
  373. $ConDMUG->SetParameter( "MOF_TAS4" , $p_MOVI_FAC[$v_i]['mof_tas4'] * 1000);
  374. # define MOVI_FAC_MOF_OBS (dbfield) 0x0b1b /* String
  375. $ConDMUG->SetParameter( "MOF_OBS" , $p_MOVI_FAC[$v_i]['mof_obs'] );
  376. # define MOVI_FAC_MOF_POL (dbfield) 0x0b1c /* Float
  377. $ConDMUG->SetParameter( "MOF_POL" , $p_MOVI_FAC[$v_i]['mof_pol'] );
  378. # define MOVI_FAC_MOF_ADU (dbfield) 0x0b1d /* Integer
  379. $ConDMUG->SetParameter( "MOF_ADU" , $p_MOVI_FAC[$v_i]['mof_adu'] );
  380. # define MOVI_FAC_MOF_DES (dbfield) 0x0b1e /* Long
  381. $ConDMUG->SetParameter( "MOF_DES" , $p_MOVI_FAC[$v_i]['mof_des'] );
  382. # define MOVI_FAC_MOF_CAD (dbfield) 0x0b1f /* Long
  383. $ConDMUG->SetParameter( "MOF_CAD" , $p_MOVI_FAC[$v_i]['mof_cad'] );
  384. # define MOVI_FAC_MOF_DDEBAR (dbfield) 0x0b20 /* Integer
  385. $ConDMUG->SetParameter( "MOF_DDEBAR" , $p_MOVI_FAC[$v_i]['mof_ddebar'] );
  386. # define MOVI_FAC_MOF_PLISTA (dbfield) 0x0b21 /* Long
  387. $ConDMUG->SetParameter( "MOF_PLISTA", $p_MOVI_FAC[$v_i]['mof_plista'] * 10000 );
  388. # define MOVI_FAC_MOF_ACCION (dbfield) 0x0b22 /* Integer
  389. $ConDMUG->SetParameter( "MOF_ACCION", $p_MOVI_FAC[$v_i]['mof_accion'] );
  390. # define MOVI_FAC_MOF_PROMO (dbfield) 0x0b23 /* Integer
  391. $ConDMUG->SetParameter( "MOF_PROMO" , $p_MOVI_FAC[$v_i]['mof_promo'] );
  392. # define MOVI_FAC_MOF_MSTRA (dbfield) 0x0b24 /* Integer
  393. $ConDMUG->SetParameter( "MOF_MSTRA" , $p_MOVI_FAC[$v_i]['mof_mstra'] );
  394. # define MOVI_FAC_MOF_ESTVT (dbfield) 0x0b25 /* Integer
  395. $ConDMUG->SetParameter( "MOF_ESTVT" , $p_MOVI_FAC[$v_i]['mof_estvt'] );
  396. # define MOVI_FAC_MOF_ESTVC (dbfield) 0x0b26 /* Integer
  397. $ConDMUG->SetParameter( "MOF_ESTVC" , $p_MOVI_FAC[$v_i]['mof_estvc'] );
  398. # define MOVI_FAC_MOF_ESTCT (dbfield) 0x0b27 /* Integer
  399. $ConDMUG->SetParameter( "MOF_ESTCT" , $p_MOVI_FAC[$v_i]['mof_estct'] );
  400. # define MOVI_FAC_MOF_ESTCC (dbfield) 0x0b28 /* Integer
  401. $ConDMUG->SetParameter( "MOF_ESTCC" , $p_MOVI_FAC[$v_i]['mof_estcc'] );
  402. # define MOVI_FAC_MOF_FAM (dbfield) 0x0b29 /* Integer
  403. $ConDMUG->SetParameter( "MOF_FAM" , $p_MOVI_FAC[$v_i]['mof_fam'] );
  404. # define MOVI_FAC_MOF_DEP (dbfield) 0x0b2a /* Integer
  405. $ConDMUG->SetParameter( "MOF_DEP" , $p_MOVI_FAC[$v_i]['mof_dep'] );
  406. # define MOVI_FAC_MOF_SEC (dbfield) 0x0b2b /* Integer
  407. $ConDMUG->SetParameter( "MOF_SEC" , $p_MOVI_FAC[$v_i]['mof_sec'] );
  408. # define MOVI_FAC_MOF_GRU (dbfield) 0x0b2c /* Integer
  409. $ConDMUG->SetParameter( "MOF_GRU" , $p_MOVI_FAC[$v_i]['mof_gru'] );
  410. # define MOVI_FAC_MOF_PREP (dbfield) 0x0b2d /* Long
  411. $ConDMUG->SetParameter( "MOF_PREP" , $p_MOVI_FAC[$v_i]['mof_prep'] * 10000 );
  412. # define MOVI_FAC_MOF_FEC (dbfield) 0x0b2e /* Date
  413. $ConDMUG->SetParameter( "MOF_FEC" , $p_MOVI_FAC[$v_i]['mof_fec'] );
  414. # define MOVI_FAC_MOF_PCONG (dbfield) 0x0b2f /* Long
  415. $ConDMUG->SetParameter( "MOF_PCONG" , $p_MOVI_FAC[$v_i]['mof_pcong'] );
  416. # define MOVI_FAC_MOF_NCSCAN (dbfield) 0x0b30 /* Long
  417. $ConDMUG->SetParameter( "MOF_NCSCAN" , $p_MOVI_FAC[$v_i]['mof_ncscan'] );
  418. # define MOVI_FAC_MOF_NCCPIE (dbfield) 0x0b31 /* Long
  419. $ConDMUG->SetParameter( "MOF_NCCPIE", $p_MOVI_FAC[$v_i]['mof_nccpie'] );
  420. # define MOVI_FAC_MOF_CBAR (dbfield) 0x0b32 /* String
  421. $ConDMUG->SetParameter( "MOF_CBAR" , $p_MOVI_FAC[$v_i]['mof_cbar'] );
  422. # define MOVI_FAC_MOF_KGSN (dbfield) 0x0b33 /* Float
  423. $ConDMUG->SetParameter( "MOF_KGSN" , $p_MOVI_FAC[$v_i]['mof_kgsn'] );
  424. # define MOVI_FAC_MOF_CATR (dbfield) 0x0b34 /* Intege
  425. $ConDMUG->SetParameter( "MOF_CATR" , $p_MOVI_FAC[$v_i]['mof_catr'] );
  426. # define MOVI_FAC_MOF_PVTAB (dbfield) 0x0b35 /* Long
  427. $ConDMUG->SetParameter( "MOF_PVTAB" , $p_MOVI_FAC[$v_i]['mof_pvtab'] * 10000 );
  428. # define MOVI_FAC_MOF_COLOR (dbfield) 0x0b36 /* String
  429. $ConDMUG->SetParameter( "MOF_COLOR" , $p_MOVI_FAC[$v_i]['mof_color'] );
  430. # define MOVI_FAC_MOF_TCOL (dbfield) 0x0b37 /* String
  431. $ConDMUG->SetParameter( "MOF_TCOL" , $p_MOVI_FAC[$v_i]['mof_tcol'] );
  432. # define MOVI_FAC_MOF_PROV (dbfield) 0x0b38 /* Long
  433. $ConDMUG->SetParameter( "MOF_PROV" , $p_MOVI_FAC[$v_i]['mof_prov'] );
  434. # define MOVI_FAC_MOF_CLIE (dbfield) 0x0b39 /* Long
  435. $ConDMUG->SetParameter( "MOF_CLIE" , $p_MOVI_FAC[$v_i]['mof_clie'] );
  436. }
  437. return $v_i ;
  438. }
  439. /***********************************************************************/
  440. /*----------------------- function Carga_CABECERA ---------------------*/
  441. /***********************************************************************/
  442. function Marca_CABECERA( $obtieneDatos_pg , $p_FACTU , $v_i )
  443. {
  444. $SUC = $p_FACTU[$v_i]['fac_suc'];
  445. $TIP = $p_FACTU[$v_i]['fac_tip'];
  446. $STIP = $p_FACTU[$v_i]['fac_stip'];
  447. $NRO = $p_FACTU[$v_i]['fac_nro'];
  448. $pg_sql_factu = "UPDATE forumvta.factu SET fac_trans = 1 WHERE fac_suc = $SUC AND fac_tip = '$TIP' ";
  449. $pg_sql_factu .="AND fac_stip = $STIP AND fac_nro = $NRO ";
  450. $obtieneDatos_pg->obtenerDatos( $pg_sql_factu );
  451. ////$errorUPDATE = pg_last_error ( $obtieneDatos_pg );
  452. ///echo "Error=".$errorUPDATE."\n";
  453. return 1;
  454. }
  455. ?>