Exemplo n.º 1
0
         if ($_GET["autofield" . $j] == $_POST["dfield" . $ix . "_" . $ix2]) {
             // columna que coinida infreso el valor
             $datakey .= ($datakey ? " and " : "") . $_GET["autofield" . $j] . " like '" . trim($_POST["dval" . $ix . "_" . $ix2]) . "'";
             $auk .= ($auk ? "-" : "") . $_POST["dval" . $ix . "_" . $ix2];
         }
         $i2++;
         $ix2 = $i2 == 0 ? "" : $i2;
     }
     $j++;
 }
 if ($datakey != "") {
     if ($sttdatato == "expedientes2") {
         $sql = mssql_query("update tb" . $sttdatato . " set anulado_exp=1 where " . $datakey);
         $sql = mssql_query("update tb" . $sttdatato . " set anulado_exp=1 where ODSSERVCOMP_EXP=" . $auk);
         foreach ($_GET as $k => $v) {
             putxt($k . ":" . $v);
         }
         audit($sttdatato, 'A', $auk, $dsanul);
         //putxt($auk);
     } else {
         if ($sttdatato == "expedientes4" || $sttdatato == "expedientes5") {
         } else {
             $sql = mssql_query("delete from tb" . $sttdatato . " where " . $datakey);
             //putxt("delete from tb".$sttdatato." where ".$datakey);
             audit($sttdatato, 'E', $auk);
         }
     }
     //echo "delete from tb".$sttdatato." where ".$datakey;
 } else {
     $sql = mssql_query("delete from tb" . $sttdatato . " where " . $datos);
     audit($sttdatato, 'E', $auk);
Exemplo n.º 2
0
 							$adds["codigo_prv"]=$row["CODIGO_AUX"];
 							$adds["AUXILIAR_PRV"]=$row["CODIGO_AUX"];	
 						} else {
 							roolback();
 							die("<b><span style='color:red'>Debe indicar nombre y rif.</span></b>");	
 						}
 					}
 				}
 			}*/
 // Guardado Principal
 $con = "";
 $conc = "";
 //$sql=mssql_query("SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='tb".$datato."'");
 $result = $mysqli->query("SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='tb" . $datato . "'");
 while ($row = $result->fetch_array(MYSQLI_NUM)) {
     putxt($_POST[$row[0]]);
     if (isset($adds[$row[0]])) {
         ///si existe en algun auxiliar
         $conc .= ($conc ? "," : "") . $row[0];
         if ($row[1] == "smalldatetime" || $row[1] == "datetime") {
             $con .= ($con ? "," : "") . "'" . toDate($adds[$row[0]]) . "'";
         } elseif ($row[1] == "float" || $row[1] == "numeric") {
             $con .= ($con ? "," : "") . "cast('" . str_replace(",", ".", $adds[$row[0]]) . "' as float)";
         } else {
             $con .= ($con ? "," : "") . "'" . stripslashes(utf8_decode($adds[$row[0]])) . "'";
         }
     } elseif (isset($_POST[$row[0]])) {
         $conc .= ($conc ? "," : "") . $row[0];
         if ($row[1] == "smalldatetime" || $row[1] == "datetime") {
             if (trim($_POST[$row[0]]) == "") {
                 $con .= ($con ? "," : "") . "NULL";
Exemplo n.º 3
0
         $data[] = $row;
     }
     echo json_encode($data);
     break;
 case "get_preFacturacion_coti":
     $sql = mssql_query("select \n\t\tproducto_ped as producto_fac,\n\t\tdescripcion_ped as descripcion_fac,\n\t\tcantidad_ped as cantidad_fac,\n\t\tprecio_ped as precio_fac,\n\t\tiva_pro_fac as iva_pro_fac,\n\t\ttotal_ped as total_fac\n\t\t  from tbcotizacion2\n\t\t  where \n\t\t\tnumero_ped in (select numero_ped from tbcotizacion1 where numero_ped='{$codigo}' and status_ped='1')\n\t\t\tand numero_ped not in (select pedido_fac from tbfacturacion1 where status_fac=1)\n\t\t");
     putxt("select \n\t\tproducto_ped as producto_fac,\n\t\tdescripcion_ped as descripcion_fac,\n\t\tcantidad_ped as cantidad_fac,\n\t\tprecio_ped as precio_fac,\n\t\tiva_pro_fac as iva_pro_fac,\n\t\ttotal_ped as total_fac\n\t\t  from tbcotizacion2\n\t\t  where \n\t\t\tnumero_ped in (select numero_ped from tbcotizacion1 where numero_ped='{$codigo}' and status_ped='1')\n\t\t\tand numero_ped not in (select pedido_fac from tbfacturacion1 where status_fac=1)\n\t\t");
     $data = array();
     while ($row = mssql_fetch_array($sql, MSSQL_ASSOC)) {
         $data[] = $row;
     }
     echo json_encode($data);
     break;
 case "get_preFacturacion_ne":
     $sql = mssql_query("select \n\t\tproducto_ped as producto_fac,\n\t\tdescripcion_ped as descripcion_fac,\n\t\tcantidad_ped as cantidad_fac,\n\t\tprecio_ped as precio_fac,\n\t\tiva_pro_fac as iva_pro_fac,\n\t\ttotal_ped as total_fac\n\t\t  from tbnotaentrega2\n\t\t  where \n\t\t\tnumero_ped in (select numero_ped from tbnotaentrega1 where numero_ped='{$codigo}' and status_ped='1')\n\t\t\tand numero_ped not in (select pedido_fac from tbfacturacion1 where status_fac=1)\n\t\t");
     putxt($sql);
     $data = array();
     while ($row = mssql_fetch_array($sql, MSSQL_ASSOC)) {
         $data[] = $row;
     }
     echo json_encode($data);
     break;
 case "aprueba_comprasprovee":
     mssql_query("update tbcompras1 set status_fac=1 where numero_fac='{$fac}'");
     mssql_query("update t1 set\n\t\tt1.existencia_pro = t1.existencia_pro + t2.cantidad_fac\n\t\tfrom tbProductos as t1\n\t\tinner join\n\t\ttbcompras2 as t2 on\n\t\tt1.codigo_pro = t2.producto_fac\n\t\twhere\n\t\tnumero_fac='{$fac}'");
     echo 'OK';
     break;
 case "revertir_comprasprovee":
     mssql_query("update tbcompras1 set status_fac=0 where numero_fac='{$fac}'");
     mssql_query("update t1 set\n\t\tt1.existencia_pro = t1.existencia_pro - t2.cantidad_fac\n\t\tfrom tbProductos as t1\n\t\tinner join\n\t\ttbcompras2 as t2 on\n\t\tt1.codigo_pro = t2.producto_fac\n\t\twhere\n\t\tnumero_fac='{$fac}'");
     echo 'OK';