#!/usr/bin/php = 4 ){ system( "/usr/bin/killall InterFactu.php" ); } $fec = date('l jS \of F Y h:i:s A'); echo "$fec:Inicia Proceso InterFactu ....\n"; $server= "192.168.1.5"; $port = 1030; //1030 $hs = "DEMIURGO10-MCANET"; $user = "general"; $pass = "123456789"; $pid = getmypid(); $limit = 100; $veces_error_server = 0; $appConfig =& new AppConfig; /* Crea un objeto para el manejo postgres */ $dataBD_PG =& $appConfig->BASE_DATOS_PG; $manejaBD_PG =& new PostgreClass($dataBD_PG["host"], $dataBD_PG["name"], $dataBD_PG["user"], $dataBD_PG["pass"]); $obtieneDatos_pg = & new ObtieneDatos_PG($appConfig, $manejaBD_PG); $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"; $v_FACTU = $obtieneDatos_pg->obtenerDatos($pg_sql_factu); $v_i=0; $control = count( $v_FACTU[0] ); //echo "control = $control\n";//responde 101 campos si leyo OK if ( $control < 10 ) { echo "NO HAY FACTURAS PARA TRANSFERIR\n"; Finalizar(); } for( $v_i=0 ; $v_FACTU[$v_i]['fac_nro'] ; $v_i++ ) { $FAC_SUC = $v_FACTU[$v_i]['fac_suc'] ; $FAC_TIP = $v_FACTU[$v_i]['fac_tip'] ; $FAC_STIP= $v_FACTU[$v_i]['fac_stip'] ; $FAC_NRO = $v_FACTU[$v_i]['fac_nro'] ; $NROEXT = $v_FACTU[$v_i]['fac_nexti']; $fec = date('l jS \of F Y h:i:s A'); echo "$fec .... FACTURA pos = $v_i sucu = $FAC_SUC tip=$FAC_TIP nro = $FAC_NRO NEXT = $NROEXT \n"; $pg_sql_movi_fac = "SELECT * FROM forumvta.movi_fac "; $pg_sql_movi_fac .="WHERE mof_suc = $FAC_SUC AND mof_tip = '$FAC_TIP' "; $pg_sql_movi_fac .="AND mof_stip = $FAC_STIP AND mof_fac = $FAC_NRO "; //echo $pg_sql_movi_fac."\n"; $v_MOVI_FAC = $obtieneDatos_pg->obtenerDatos( $pg_sql_movi_fac ); $ConDMUG = new ConexDMUG( $server , $port , $hs ,$user , $pass ); $ConDMUG->SetProgram( "Interfaz_FactuPG_Forum" ); Carga_CABECERA( $ConDMUG , $v_FACTU , $v_i ); $v_CantiDetalles = Carga_DETALLES( $ConDMUG , $v_MOVI_FAC ); $ConDMUG->SetParameter( "CANTIDAD_CABECERAS" , 1 ); $ConDMUG->SetParameter( "CANTIDAD_DETALLES" , $v_CantiDetalles ); $ConDMUG->SetParameter( "FECHA_TRASMITE" , date() ); $ConDMUG->SetParameter( "HORA_TRASMITE" , time() ); if ( $ConDMUG->Execute_DMUG() < 0) { $fec = date('l jS \of F Y h:i:s A'); echo "$fec : ERROR EN CONEXION CON SERVER , esperando 3 segundos para continuar ....\n"; $veces_error_server++; if ( $veces_error_server > 2 ) { $fec = date('l jS \of F Y h:i:s A'); echo "$fec :FINALIZA POR ERROR DE CONEXION CON SERVER !!!!!!!!!!\n"; Finalizar(); } sleep(3); continue; } $RESULTADO = $ConDMUG->GetChild( "STRERROR" ); echo "RESULTADO:".$RESULTADO."\n" ; echo "ERROR:".$ConDMUG->GetChild( "ERROR" )."\n" ; echo "INFORME :".$ConDMUG->GetChild( "INFO1" )."\n" ; echo "INFORME :".$ConDMUG->GetChild( "INFO2" )."\n" ; echo "PUTRECORD:".$ConDMUG->GetChild( "PUTRECORD" )."\n" ; echo "REGISTROS:".$ConDMUG->GetChild( "REGISTROS" )."\n" ; $ConDMUG->CloseConex(); if ( $RESULTADO== "EXACTO" ) { echo "Se marca FACTU $FAC_NRO en PG TRANS es 1 \n"; Marca_CABECERA( $obtieneDatos_pg , $v_FACTU , $v_i ); } else { echo "ERROR en $FAC_NRO \n"; } unset($v_MOVI_FAC); echo "-------------------------------------------------------\n"; sleep(1); } unset($v_FACTU); Finalizar(); /***********************************************************************/ function Finalizar() { system( "/bin/rm /tmp/InterFactu.blk" ); exit(); } /***********************************************************************/ /*----------------------- function Carga_CABECERA ---------------------*/ /***********************************************************************/ function Carga_CABECERA( $ConDMUG , $p_FACTU , $v_i ) { # define FACTU_FAC_SUC (dbfield) 0x0a01 /* Integer / $ConDMUG->SetParameter("FAC_SUC" , $p_FACTU[$v_i]['fac_suc'] ); # define FACTU_FAC_TIP (dbfield) 0x0a02 /* String $ConDMUG->SetParameter("FAC_TIP" , $p_FACTU[$v_i]['fac_tip'] ); # define FACTU_FAC_STIP (dbfield) 0x0a03 /* Integer $ConDMUG->SetParameter("FAC_STIP" , $p_FACTU[$v_i]['fac_stip'] ); # define FACTU_FAC_NRO (dbfield) 0x0a04 /* Long $ConDMUG->SetParameter("FAC_NRO" , $p_FACTU[$v_i]['fac_nro'] ); # define FACTU_FAC_FEC (dbfield) 0x0a05 /* Date / $ConDMUG->SetParameter("FAC_FEC" , $p_FACTU[$v_i]['fac_fec'] ); # define FACTU_FAC_CLIE (dbfield) 0x0a06 /* Long / $ConDMUG->SetParameter("FAC_CLIE" , $p_FACTU[$v_i]['fac_clie'] ); # define FACTU_FAC_FPED (dbfield) 0x0a07 /* Date / $ConDMUG->SetParameter("FAC_FPED" , $p_FACTU[$v_i]['fac_fped'] ); # define FACTU_FAC_NREP (dbfield) 0x0a08 /* Long / $ConDMUG->SetParameter("FAC_NREP" , $p_FACTU[$v_i]['fac_nrep'] ); # define FACTU_FAC_CPAG (dbfield) 0x0a09 /* Integer / $ConDMUG->SetParameter("FAC_CPAG" , $p_FACTU[$v_i]['fac_cpag'] ); # define FACTU_FAC_IVA (dbfield) 0x0a0a /* Integer / $ConDMUG->SetParameter("FAC_IVA" , $p_FACTU[$v_i]['fac_iva'] ); # define FACTU_FAC_CAJA (dbfield) 0x0a0b /* Integer / $ConDMUG->SetParameter("FAC_CAJA" , $p_FACTU[$v_i]['fac_caja'] ); # define FACTU_FAC_CAJ (dbfield) 0x0a0c /* Integer / $ConDMUG->SetParameter("FAC_CAJ" , $p_FACTU[$v_i]['fac_caj'] ); # define FACTU_FAC_FAC (dbfield) 0x0a0d /* Integer $ConDMUG->SetParameter("FAC_FAC" , $p_FACTU[$v_i]['fac_fac'] ); # define FACTU_FAC_SEC (dbfield) 0x0a0e /* String / $ConDMUG->SetParameter("FAC_SEC" , $p_FACTU[$v_i]['fac_sec'] ); # define FACTU_FAC_TVEN (dbfield) 0x0a0f /* String $ConDMUG->SetParameter("FAC_TVEN" , $p_FACTU[$v_i]['fac_tven'] ); # define FACTU_FAC_COM (dbfield) 0x0a10 /* Long / $ConDMUG->SetParameter("FAC_COM" , $p_FACTU[$v_i]['fac_com'] ); # define FACTU_FAC_TDEV (dbfield) 0x0a11 /* String $ConDMUG->SetParameter("FAC_TDEV" , $p_FACTU[$v_i]['fac_tdev'] ); # define FACTU_FAC_SDEV (dbfield) 0x0a12 /* Integer $ConDMUG->SetParameter("FAC_SDEV" , $p_FACTU[$v_i]['fac_sdev'] ); # define FACTU_FAC_NDEV (dbfield) 0x0a13 /* Long / $ConDMUG->SetParameter("FAC_NDEV" , $p_FACTU[$v_i]['fac_ndev'] ); # define FACTU_FAC_FDEV (dbfield) 0x0a14 /* Date $ConDMUG->SetParameter("FAC_FDEV" , $p_FACTU[$v_i]['fac_fdev'] ); # define FACTU_FAC_DES (dbfield) 0x0a15 /* Long / $ConDMUG->SetParameter("FAC_DES" , $p_FACTU[$v_i]['fac_des'] * 100 ); # define FACTU_FAC_RECCP (dbfield) 0x0a16 /* Long / $ConDMUG->SetParameter("FAC_RECCP", $p_FACTU[$v_i]['fac_reccp'] * 100 ); # define FACTU_FAC_RECVT (dbfield) 0x0a17 /* Long / $ConDMUG->SetParameter("FAC_RECVT", $p_FACTU[$v_i]['fac_recvt'] * 100 ); # define FACTU_FAC_RECOF (dbfield) 0x0a18 /* Long / $ConDMUG->SetParameter("FAC_RECOF", $p_FACTU[$v_i]['fac_recof'] * 100 ); # define FACTU_FAC_RECUN (dbfield) 0x0a19 /* Long / $ConDMUG->SetParameter("FAC_RECUN", $p_FACTU[$v_i]['fac_recun'] * 100 ); # define FACTU_FAC_LIS (dbfield) 0x0a1a /* Integer $ConDMUG->SetParameter("FAC_LIS" , $p_FACTU[$v_i]['fac_lis'] ); # define FACTU_FAC_TGRA (dbfield) 0x0a1b /* Float / $ConDMUG->SetParameter("FAC_TGRA" , $p_FACTU[$v_i]['fac_tgra'] * 100 ); # define FACTU_FAC_TEIVA (dbfield) 0x0a1c /* Float / $ConDMUG->SetParameter("FAC_TEIVA", $p_FACTU[$v_i]['fac_teiva'] * 100 ); # define FACTU_FAC_RPIE (dbfield) 0x0a1d /* Float / $ConDMUG->SetParameter("FAC_RPIE" , $p_FACTU[$v_i]['fac_rpie'] * 100 ); # define FACTU_FAC_FLE (dbfield) 0x0a1e /* Integer / $ConDMUG->SetParameter("FAC_FLE" , $p_FACTU[$v_i]['fac_fle'] ); # define FACTU_FAC_FLCA (dbfield) 0x0a1f /* Integer $ConDMUG->SetParameter("FAC_FLCA" , $p_FACTU[$v_i]['fac_flca'] ); # define FACTU_FAC_FLET (dbfield) 0x0a20 /* Long $ConDMUG->SetParameter("FAC_FLET" , $p_FACTU[$v_i]['fac_flet'] ); # define FACTU_FAC_FLPO (dbfield) 0x0a21 /* Long / $ConDMUG->SetParameter("FAC_FLPO" , $p_FACTU[$v_i]['fac_flpo'] * 100 ); # define FACTU_FAC_IFLE (dbfield) 0x0a22 /* Float $ConDMUG->SetParameter("FAC_IFLE" , $p_FACTU[$v_i]['fac_ifle'] * 100 ); # define FACTU_FAC_TIVA (dbfield) 0x0a23 /* Float/ $ConDMUG->SetParameter("FAC_TIVA" , $p_FACTU[$v_i]['fac_tiva'] * 100 ); # define FACTU_FAC_TNIVA (dbfield) 0x0a24 /* Float $ConDMUG->SetParameter("FAC_TNIVA", $p_FACTU[$v_i]['fac_tniva'] * 100 ); # define FACTU_FAC_TIVAP (dbfield) 0x0a25 /* Float $ConDMUG->SetParameter("FAC_TIVAP", $p_FACTU[$v_i]['fac_tivap'] * 100 ); # define FACTU_FAC_TIINT (dbfield) 0x0a26 /* Float $ConDMUG->SetParameter("FAC_TIINT", $p_FACTU[$v_i]['fac_tiint'] * 100 ); # define FACTU_FAC_TABAS (dbfield) 0x0a27 /* Float $ConDMUG->SetParameter("FAC_TABAS", $p_FACTU[$v_i]['fac_tabas'] * 100 ); # define FACTU_FAC_IPOL (dbfield) 0x0a28 /* Float $ConDMUG->SetParameter("FAC_IPOL" , $p_FACTU[$v_i]['fac_ipol'] ); # define FACTU_FAC_INGB (dbfield) 0x0a29 /* Float $ConDMUG->SetParameter("FAC_INGB" , $p_FACTU[$v_i]['fac_ingb']* 100 ); # define FACTU_FAC_PIBBS (dbfield) 0x0a2a /* Float $ConDMUG->SetParameter("FAC_PIBBS", $p_FACTU[$v_i]['fac_pibbs'] * 100 ); # define FACTU_FAC_PIB14 (dbfield) 0x0a2b /* Float / $ConDMUG->SetParameter("FAC_PIB14", $p_FACTU[$v_i]['fac_pib14']* 100 ); # define FACTU_FAC_ITOT (dbfield) 0x0a2c /* Float / $ConDMUG->SetParameter("FAC_ITOT" , $p_FACTU[$v_i]['fac_itot'] * 100 ); # define FACTU_FAC_REC (dbfield) 0x0a2d /* Float / $ConDMUG->SetParameter("FAC_REC" , $p_FACTU[$v_i]['fac_rec'] * 100 ); # define FACTU_FAC_ICOM (dbfield) 0x0a2e /* Float $ConDMUG->SetParameter("FAC_ICOM" , $p_FACTU[$v_i]['fac_icom']* 100 ); # define FACTU_FAC_IMP (dbfield) 0x0a2f /* Integer $ConDMUG->SetParameter("FAC_IMP" , $p_FACTU[$v_i]['fac_imp'] ); # define FACTU_FAC_ADM (dbfield) 0x0a30 /* Integer $ConDMUG->SetParameter("FAC_ADM" , $p_FACTU[$v_i]['fac_adm'] ); # define FACTU_FAC_OBS (dbfield) 0x0a31 /* String $ConDMUG->SetParameter("FAC_OBS" , $p_FACTU[$v_i]['fac_obs'] ); # define FACTU_FAC_CON1 (dbfield) 0x0a32 /* Integer $ConDMUG->SetParameter("FAC_CON1" , $p_FACTU[$v_i]['fac_con1'] ); # define FACTU_FAC_CON2 (dbfield) 0x0a33 /* Integer $ConDMUG->SetParameter("FAC_CON2" , $p_FACTU[$v_i]['fac_con2'] ); # define FACTU_FAC_IT (dbfield) 0x0a34 /* Integer / $ConDMUG->SetParameter("FAC_IT" , $p_FACTU[$v_i]['fac_it'] ); # define FACTU_FAC_REVTA (dbfield) 0x0a35 /* Long / $ConDMUG->SetParameter("FAC_REVTA", $p_FACTU[$v_i]['fac_revta'] * 100 ); # define FACTU_FAC_TRES (dbfield) 0x0a36 /* String / $ConDMUG->SetParameter("FAC_TRES" , $p_FACTU[$v_i]['fac_tres'] ); # define FACTU_FAC_ORES (dbfield) 0x0a37 /* Integer $ConDMUG->SetParameter("FAC_ORES" , $p_FACTU[$v_i]['fac_ores'] ); # define FACTU_FAC_NRES (dbfield) 0x0a38 /* Long / $ConDMUG->SetParameter("FAC_NRES" , $p_FACTU[$v_i]['fac_nres'] ); # define FACTU_FAC_HORA (dbfield) 0x0a39 /* Time / $ConDMUG->SetParameter("FAC_HORA" , $p_FACTU[$v_i]['fac_hora'] ); # define FACTU_FAC_DUP (dbfield) 0x0a3a /* Integer / $ConDMUG->SetParameter("FAC_DUP" , $p_FACTU[$v_i]['fac_dup'] ); # define FACTU_FAC_FAF (dbfield) 0x0a3b /* Long / $ConDMUG->SetParameter("FAC_FAF" , $p_FACTU[$v_i]['fac_faf'] ); # define FACTU_FAC_MOT (dbfield) 0x0a3c /* Integer / $ConDMUG->SetParameter("FAC_MOT" , $p_FACTU[$v_i]['fac_mot'] ); # define FACTU_FAC_NOM (dbfield) 0x0a3d /* String / $ConDMUG->SetParameter("FAC_NOM" , $p_FACTU[$v_i]['fac_nom'] ); # define FACTU_FAC_CPOS (dbfield) 0x0a3e /* Integer / $ConDMUG->SetParameter("FAC_CPOS" , $p_FACTU[$v_i]['fac_cpos'] ); # define FACTU_FAC_CMP (dbfield) 0x0a3f /* String / $ConDMUG->SetParameter("FAC_CMP" , $p_FACTU[$v_i]['fac_cmp'] ); # define FACTU_FAC_CAT (dbfield) 0x0a40 /* Integer / $ConDMUG->SetParameter("FAC_CAT" , $p_FACTU[$v_i]['fac_cat'] ); # define FACTU_FAC_ZON (dbfield) 0x0a41 /* Integer / $ConDMUG->SetParameter("FAC_ZON" , $p_FACTU[$v_i]['fac_zon'] ); # define FACTU_FAC_TVTA (dbfield) 0x0a42 /* String / $ConDMUG->SetParameter("FAC_TVTA" , $p_FACTU[$v_i]['fac_tvta'] ); # define FACTU_FAC_TIPOP (dbfield) 0x0a43 /* String / $ConDMUG->SetParameter("FAC_TIPOP", $p_FACTU[$v_i]['fac_tipop'] ); # define FACTU_FAC_FEXT (dbfield) 0x0a44 /* Date / $ConDMUG->SetParameter("FAC_FEXT" , $p_FACTU[$v_i]['fac_fext'] ); # define FACTU_FAC_TEXT (dbfield) 0x0a45 /* String / $ConDMUG->SetParameter("FAC_TEXT" , $p_FACTU[$v_i]['fac_text'] ); # define FACTU_FAC_LEXT (dbfield) 0x0a46 /* Integer / $ConDMUG->SetParameter("FAC_LEXT" , $p_FACTU[$v_i]['fac_lext'] ); # define FACTU_FAC_SEXT (dbfield) 0x0a47 /* String / $ConDMUG->SetParameter("FAC_SEXT" , $p_FACTU[$v_i]['fac_sext'] ); # define FACTU_FAC_NEXTI (dbfield) 0x0a48 /* Long / $ConDMUG->SetParameter("FAC_NEXTI", $p_FACTU[$v_i]['fac_nexti'] ); # define FACTU_FAC_NEXTF (dbfield) 0x0a49 /* Long / $ConDMUG->SetParameter("FAC_NEXTF", $p_FACTU[$v_i]['fac_nextf'] ); # define FACTU_FAC_AFEST (dbfield) 0x0a4a /* Integer / $ConDMUG->SetParameter("FAC_AFEST", $p_FACTU[$v_i]['fac_afest'] ); # define FACTU_FAC_ESTVT (dbfield) 0x0a4b /* Integer / $ConDMUG->SetParameter("FAC_ESTVT", $p_FACTU[$v_i]['fac_estvt'] ); # define FACTU_FAC_ESTVC (dbfield) 0x0a4c /* Integer / $ConDMUG->SetParameter("FAC_ESTVC", $p_FACTU[$v_i]['fac_estvc'] ); # define FACTU_FAC_ESTCT (dbfield) 0x0a4d /* Integer / $ConDMUG->SetParameter("FAC_ESTCT", $p_FACTU[$v_i]['fac_estct'] ); # define FACTU_FAC_ESTCC (dbfield) 0x0a4e /* Integer / $ConDMUG->SetParameter("FAC_ESTCC", $p_FACTU[$v_i]['fac_estcc'] ); # define FACTU_FAC_CODEST (dbfield) 0x0a4f /* String $ConDMUG->SetParameter("FAC_CODEST", $p_FACTU[$v_i]['fac_codest'] ); # define FACTU_FAC_TCEST (dbfield) 0x0a50 /* String / $ConDMUG->SetParameter("FAC_TCEST" , $p_FACTU[$v_i]['fac_tcest'] ); # define FACTU_FAC_MAFEST (dbfield) 0x0a51 /* String / $ConDMUG->SetParameter("FAC_MAFEST", $p_FACTU[$v_i]['fac_mafest'] ); # define FACTU_FAC_REG (dbfield) 0x0a52 /* String / $ConDMUG->SetParameter("FAC_REG" , $p_FACTU[$v_i]['fac_reg'] ); # define FACTU_FAC_LUGENT (dbfield) 0x0a53 /* Integer / $ConDMUG->SetParameter("FAC_LUGENT", $p_FACTU[$v_i]['fac_lugent'] ); # define FACTU_FAC_NCAI (dbfield) 0x0a54 /* String / $ConDMUG->SetParameter("FAC_NCAI" , $p_FACTU[$v_i]['fac_ncai'] ); # define FACTU_FAC_FVCAI (dbfield) 0x0a55 /* Date / $ConDMUG->SetParameter("FAC_FVCAI" , $p_FACTU[$v_i]['fac_fvcai'] ); # define FACTU_FAC_CFIS (dbfield) 0x0a56 /* Integer / $ConDMUG->SetParameter("FAC_CFIS" , $p_FACTU[$v_i]['fac_cfis'] ); # define FACTU_FAC_COSTO (dbfield) 0x0a57 /* Float / $ConDMUG->SetParameter("FAC_COSTO" , $p_FACTU[$v_i]['fac_costo'] * 100 ); # define FACTU_FAC_AUXF (dbfield) 0x0a58 /* Integer / $ConDMUG->SetParameter("FAC_AUXF" , $p_FACTU[$v_i]['fac_auxf'] ); # define FACTU_FAC_TIVAF (dbfield) 0x0a59 /* Float / $ConDMUG->SetParameter("FAC_TIVAF" , $p_FACTU[$v_i]['fac_tivaf'] * 100 ); # define FACTU_FAC_TNIVAF (dbfield) 0x0a5a /* Float / $ConDMUG->SetParameter("FAC_TNIVAF", $p_FACTU[$v_i]['fac_tnivaf'] * 100 ); # define FACTU_FAC_ENTIP (dbfield) 0x0a5b /* Long / $ConDMUG->SetParameter("FAC_ENTIP" , $p_FACTU[$v_i]['fac_entip'] ); # define FACTU_FAC_TKGSN (dbfield) 0x0a5c /* Float/ $ConDMUG->SetParameter("FAC_TKGSN" , $p_FACTU[$v_i]['fac_tkgsn'] * 1000 ); # define FACTU_FAC_TXKG (dbfield) 0x0a5d /* Float/ $ConDMUG->SetParameter("FAC_TXKG" , $p_FACTU[$v_i]['fac_txkg'] * 100 ); # define FACTU_FAC_INC (dbfield) 0x0a5e /* Float $ConDMUG->SetParameter("FAC_INC" , $p_FACTU[$v_i]['fac_inc'] * 100 ); # define FACTU_FAC_CNC (dbfield) 0x0a5f /* Integer / $ConDMUG->SetParameter("FAC_CNC" , $p_FACTU[$v_i]['fac_cnc'] ); # define FACTU_FAC_EMP (dbfield) 0x0a60 /* Integer / $ConDMUG->SetParameter("FAC_EMP" , $p_FACTU[$v_i]['fac_emp'] ); # define FACTU_FAC_CONSO (dbfield) 0x0a61 /* Long $ConDMUG->SetParameter("FAC_CONSO" , $p_FACTU[$v_i]['fac_conso'] ); # define FACTU_FAC_OBSC (dbfield) 0x0a62 /* String / $ConDMUG->SetParameter("FAC_OBSC" , $p_FACTU[$v_i]['fac_obsc'] ); # define FACTU_FAC_HPED (dbfield) 0x0a63 /* Time / $ConDMUG->SetParameter("FAC_HPED" , $p_FACTU[$v_i]['fac_hped'] ); # define FACTU_FAC_CBUL (dbfield) 0x0a64 /* Integer / $ConDMUG->SetParameter("FAC_CBUL" , $p_FACTU[$v_i]['fac_cbul'] ); # define FACTU_FAC_NREM (dbfield) 0x0a65 /* Long $ConDMUG->SetParameter("FAC_NREM" , $p_FACTU[$v_i]['fac_nrem'] ); # define FACTU_FAC_CBAR (dbfield) 0x0a66 /* String $ConDMUG->SetParameter("FAC_CBAR" , $p_FACTU[$v_i]['fac_cbar'] ); } /****************************************************************************************/ /*--------------------------- function Carga_DETALLES ----------------------------------*/ /****************************************************************************************/ function Carga_DETALLES( $ConDMUG , $p_MOVI_FAC ) { $v_i = 0 ; for( $v_i=0 ; $p_MOVI_FAC[$v_i]['mof_fac'] ; $v_i++ ) { echo "--->DETALLE pos = $v_i FACTURA = ".$p_MOVI_FAC[$v_i]['mof_fac']." ART=".$p_MOVI_FAC[$v_i]['mof_art']."\n"; # define MOVI_FAC_MOF_SUC (dbfield) 0x0b01 nteger $ConDMUG->SetParameter( "MOF_SUC" , $p_MOVI_FAC[$v_i]['mof_suc'] ); # define MOVI_FAC_MOF_TIP (dbfield) 0x0b02 /* String $ConDMUG->SetParameter( "MOF_TIP" , $p_MOVI_FAC[$v_i]['mof_tip'] ); # define MOVI_FAC_MOF_STIP (dbfield) 0x0b03 /* Integer $ConDMUG->SetParameter( "MOF_STIP" , $p_MOVI_FAC[$v_i]['mof_stip'] ); # define MOVI_FAC_MOF_FAC (dbfield) 0x0b04 /* Long $ConDMUG->SetParameter( "MOF_FAC" , $p_MOVI_FAC[$v_i]['mof_fac'] ); # define MOVI_FAC_MOF_ART (dbfield) 0x0b05 /* Long $ConDMUG->SetParameter( "MOF_ART" , $p_MOVI_FAC[$v_i]['mof_art'] ); # define MOVI_FAC_MOF_ITE (dbfield) 0x0b06 /* Integer $ConDMUG->SetParameter( "MOF_ITE" , $p_MOVI_FAC[$v_i]['mof_ite'] ); # define MOVI_FAC_MOF_DEV (dbfield) 0x0b07 /* Integer $ConDMUG->SetParameter( "MOF_DEV" , $p_MOVI_FAC[$v_i]['mof_dev'] ); # define MOVI_FAC_MOF_PREC (dbfield) 0x0b08 /* Long $ConDMUG->SetParameter( "MOF_PREC" , $p_MOVI_FAC[$v_i]['mof_prec'] * 10000 ); # define MOVI_FAC_MOF_COST (dbfield) 0x0b09 /* Long $ConDMUG->SetParameter( "MOF_COST" , $p_MOVI_FAC[$v_i]['mof_cost'] * 10000); # define MOVI_FAC_MOF_CANT (dbfield) 0x0b0a /* Long $ConDMUG->SetParameter( "MOF_CANT" , $p_MOVI_FAC[$v_i]['mof_cant'] * 10000); # define MOVI_FAC_MOF_UDAD (dbfield) 0x0b0b /* String $ConDMUG->SetParameter( "MOF_UDAD" , $p_MOVI_FAC[$v_i]['mof_udad'] ); # define MOVI_FAC_MOF_IABA (dbfield) 0x0b0/* Long $ConDMUG->SetParameter( "MOF_IABA" ,$p_MOVI_FAC[$v_i]['mof_iaba'] * 10000 ); # define MOVI_FAC_MOF_IINT (dbfield) 0x0b0d /* Long $ConDMUG->SetParameter( "MOF_IINT" , $p_MOVI_FAC[$v_i]['mof_iint'] * 10000 ); # define MOVI_FAC_MOF_OFE (dbfield) 0x0b0e /* Integer $ConDMUG->SetParameter( "MOF_OFE" ,$p_MOVI_FAC[$v_i]['mof_ofe'] ); # define MOVI_FAC_MOF_DIG (dbfield) 0x0b0f /* Integer $ConDMUG->SetParameter( "MOF_DIG" ,$p_MOVI_FAC[$v_i]['mof_dig'] ); # define MOVI_FAC_MOF_SCAN (dbfield) 0x0b10 /* Long $ConDMUG->SetParameter( "MOF_SCAN" , $p_MOVI_FAC[$v_i]['mof_scan'] ); # define MOVI_FAC_MOF_CPIE (dbfield) 0x0b11 /* Long $ConDMUG->SetParameter( "MOF_CPIE" ,$p_MOVI_FAC[$v_i]['mof_cpie'] ); # define MOVI_FAC_MOF_MVT (dbfield) 0x0b12 /* Integer $ConDMUG->SetParameter( "MOF_MVT" , $p_MOVI_FAC[$v_i]['mof_mvt'] ); # define MOVI_FAC_MOF_IVA1 (dbfield) 0x0b13 /* Float $ConDMUG->SetParameter( "MOF_IVA1" , $p_MOVI_FAC[$v_i]['mof_iva1'] * 1000); # define MOVI_FAC_MOF_IVA2 (dbfield) 0x0b14 /* Float $ConDMUG->SetParameter( "MOF_IVA2" , $p_MOVI_FAC[$v_i]['mof_iva2'] * 1000 ); # define MOVI_FAC_MOF_IVA3 (dbfield) 0x0b15 /* Float $ConDMUG->SetParameter( "MOF_IVA3" , $p_MOVI_FAC[$v_i]['mof_iva3'] * 1000 ); # define MOVI_FAC_MOF_IVA4 (dbfield) 0x0b16 /* Float $ConDMUG->SetParameter( "MOF_IVA4" , $p_MOVI_FAC[$v_i]['mof_iva4'] * 1000 ); # define MOVI_FAC_MOF_TAS1 (dbfield) 0x0b17 /* Long $ConDMUG->SetParameter( "MOF_TAS1" , $p_MOVI_FAC[$v_i]['mof_tas1'] * 1000); # define MOVI_FAC_MOF_TAS2 (dbfield) 0x0b18 /* Long $ConDMUG->SetParameter( "MOF_TAS2" , $p_MOVI_FAC[$v_i]['mof_tas2'] * 1000); # define MOVI_FAC_MOF_TAS3 (dbfield) 0x0b19 /* Long $ConDMUG->SetParameter( "MOF_TAS3" , $p_MOVI_FAC[$v_i]['mof_tas3'] * 1000); # define MOVI_FAC_MOF_TAS4 (dbfield) 0x0b1a /* Long $ConDMUG->SetParameter( "MOF_TAS4" , $p_MOVI_FAC[$v_i]['mof_tas4'] * 1000); # define MOVI_FAC_MOF_OBS (dbfield) 0x0b1b /* String $ConDMUG->SetParameter( "MOF_OBS" , $p_MOVI_FAC[$v_i]['mof_obs'] ); # define MOVI_FAC_MOF_POL (dbfield) 0x0b1c /* Float $ConDMUG->SetParameter( "MOF_POL" , $p_MOVI_FAC[$v_i]['mof_pol'] ); # define MOVI_FAC_MOF_ADU (dbfield) 0x0b1d /* Integer $ConDMUG->SetParameter( "MOF_ADU" , $p_MOVI_FAC[$v_i]['mof_adu'] ); # define MOVI_FAC_MOF_DES (dbfield) 0x0b1e /* Long $ConDMUG->SetParameter( "MOF_DES" , $p_MOVI_FAC[$v_i]['mof_des'] ); # define MOVI_FAC_MOF_CAD (dbfield) 0x0b1f /* Long $ConDMUG->SetParameter( "MOF_CAD" , $p_MOVI_FAC[$v_i]['mof_cad'] ); # define MOVI_FAC_MOF_DDEBAR (dbfield) 0x0b20 /* Integer $ConDMUG->SetParameter( "MOF_DDEBAR" , $p_MOVI_FAC[$v_i]['mof_ddebar'] ); # define MOVI_FAC_MOF_PLISTA (dbfield) 0x0b21 /* Long $ConDMUG->SetParameter( "MOF_PLISTA", $p_MOVI_FAC[$v_i]['mof_plista'] * 10000 ); # define MOVI_FAC_MOF_ACCION (dbfield) 0x0b22 /* Integer $ConDMUG->SetParameter( "MOF_ACCION", $p_MOVI_FAC[$v_i]['mof_accion'] ); # define MOVI_FAC_MOF_PROMO (dbfield) 0x0b23 /* Integer $ConDMUG->SetParameter( "MOF_PROMO" , $p_MOVI_FAC[$v_i]['mof_promo'] ); # define MOVI_FAC_MOF_MSTRA (dbfield) 0x0b24 /* Integer $ConDMUG->SetParameter( "MOF_MSTRA" , $p_MOVI_FAC[$v_i]['mof_mstra'] ); # define MOVI_FAC_MOF_ESTVT (dbfield) 0x0b25 /* Integer $ConDMUG->SetParameter( "MOF_ESTVT" , $p_MOVI_FAC[$v_i]['mof_estvt'] ); # define MOVI_FAC_MOF_ESTVC (dbfield) 0x0b26 /* Integer $ConDMUG->SetParameter( "MOF_ESTVC" , $p_MOVI_FAC[$v_i]['mof_estvc'] ); # define MOVI_FAC_MOF_ESTCT (dbfield) 0x0b27 /* Integer $ConDMUG->SetParameter( "MOF_ESTCT" , $p_MOVI_FAC[$v_i]['mof_estct'] ); # define MOVI_FAC_MOF_ESTCC (dbfield) 0x0b28 /* Integer $ConDMUG->SetParameter( "MOF_ESTCC" , $p_MOVI_FAC[$v_i]['mof_estcc'] ); # define MOVI_FAC_MOF_FAM (dbfield) 0x0b29 /* Integer $ConDMUG->SetParameter( "MOF_FAM" , $p_MOVI_FAC[$v_i]['mof_fam'] ); # define MOVI_FAC_MOF_DEP (dbfield) 0x0b2a /* Integer $ConDMUG->SetParameter( "MOF_DEP" , $p_MOVI_FAC[$v_i]['mof_dep'] ); # define MOVI_FAC_MOF_SEC (dbfield) 0x0b2b /* Integer $ConDMUG->SetParameter( "MOF_SEC" , $p_MOVI_FAC[$v_i]['mof_sec'] ); # define MOVI_FAC_MOF_GRU (dbfield) 0x0b2c /* Integer $ConDMUG->SetParameter( "MOF_GRU" , $p_MOVI_FAC[$v_i]['mof_gru'] ); # define MOVI_FAC_MOF_PREP (dbfield) 0x0b2d /* Long $ConDMUG->SetParameter( "MOF_PREP" , $p_MOVI_FAC[$v_i]['mof_prep'] * 10000 ); # define MOVI_FAC_MOF_FEC (dbfield) 0x0b2e /* Date $ConDMUG->SetParameter( "MOF_FEC" , $p_MOVI_FAC[$v_i]['mof_fec'] ); # define MOVI_FAC_MOF_PCONG (dbfield) 0x0b2f /* Long $ConDMUG->SetParameter( "MOF_PCONG" , $p_MOVI_FAC[$v_i]['mof_pcong'] ); # define MOVI_FAC_MOF_NCSCAN (dbfield) 0x0b30 /* Long $ConDMUG->SetParameter( "MOF_NCSCAN" , $p_MOVI_FAC[$v_i]['mof_ncscan'] ); # define MOVI_FAC_MOF_NCCPIE (dbfield) 0x0b31 /* Long $ConDMUG->SetParameter( "MOF_NCCPIE", $p_MOVI_FAC[$v_i]['mof_nccpie'] ); # define MOVI_FAC_MOF_CBAR (dbfield) 0x0b32 /* String $ConDMUG->SetParameter( "MOF_CBAR" , $p_MOVI_FAC[$v_i]['mof_cbar'] ); # define MOVI_FAC_MOF_KGSN (dbfield) 0x0b33 /* Float $ConDMUG->SetParameter( "MOF_KGSN" , $p_MOVI_FAC[$v_i]['mof_kgsn'] ); # define MOVI_FAC_MOF_CATR (dbfield) 0x0b34 /* Intege $ConDMUG->SetParameter( "MOF_CATR" , $p_MOVI_FAC[$v_i]['mof_catr'] ); # define MOVI_FAC_MOF_PVTAB (dbfield) 0x0b35 /* Long $ConDMUG->SetParameter( "MOF_PVTAB" , $p_MOVI_FAC[$v_i]['mof_pvtab'] * 10000 ); # define MOVI_FAC_MOF_COLOR (dbfield) 0x0b36 /* String $ConDMUG->SetParameter( "MOF_COLOR" , $p_MOVI_FAC[$v_i]['mof_color'] ); # define MOVI_FAC_MOF_TCOL (dbfield) 0x0b37 /* String $ConDMUG->SetParameter( "MOF_TCOL" , $p_MOVI_FAC[$v_i]['mof_tcol'] ); # define MOVI_FAC_MOF_PROV (dbfield) 0x0b38 /* Long $ConDMUG->SetParameter( "MOF_PROV" , $p_MOVI_FAC[$v_i]['mof_prov'] ); # define MOVI_FAC_MOF_CLIE (dbfield) 0x0b39 /* Long $ConDMUG->SetParameter( "MOF_CLIE" , $p_MOVI_FAC[$v_i]['mof_clie'] ); } return $v_i ; } /***********************************************************************/ /*----------------------- function Carga_CABECERA ---------------------*/ /***********************************************************************/ function Marca_CABECERA( $obtieneDatos_pg , $p_FACTU , $v_i ) { $SUC = $p_FACTU[$v_i]['fac_suc']; $TIP = $p_FACTU[$v_i]['fac_tip']; $STIP = $p_FACTU[$v_i]['fac_stip']; $NRO = $p_FACTU[$v_i]['fac_nro']; $pg_sql_factu = "UPDATE forumvta.factu SET fac_trans = 1 WHERE fac_suc = $SUC AND fac_tip = '$TIP' "; $pg_sql_factu .="AND fac_stip = $STIP AND fac_nro = $NRO "; $obtieneDatos_pg->obtenerDatos( $pg_sql_factu ); ////$errorUPDATE = pg_last_error ( $obtieneDatos_pg ); ///echo "Error=".$errorUPDATE."\n"; return 1; } ?>