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.

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