PHP buscador
zerox5773 de Junio de 2015
15.840 Palabras (64 Páginas)145 Visitas
<?php
$orden = $_POST ["consulta"];
include("conexionhistorico.php");
$query = "SELECT * FROM controlordenes WHERE orden ='$orden'";
$result = mysql_query($query) or die('Consulta fallida: ' . mysql_error());
//$result= mysql_query("SELECT * FROM hojadevidaequipo WHERE codigo ='321'");
if (mysql_num_rows($result))
{
while ($row=mysql_fetch_array($result))
{
$estado = $row ['estado'];
$facturacion = $row ['facturacion'];
$gestion_de_pago = $row ['gestion_de_pago'];
$estado_de_pago = $row ['estado_de_pago'];
$orden = $row ['orden'];
$regional = $row ['regional'];
$cliente = $row ['cliente'];
$verticaltrabajador = $row ['verticaltrabajador'];
$trabajador = $row ['trabajador'];
$empresa = $row ['empresa'];
$concepto = $row ['concepto'];
$gestor = $row ['gestor'];
$horas = $row ['horas'];
$valor = $row['valor'];
$aplica_iva = $row ['aplica_iva'];
$subtotal = $row ['subtotal'];
$iva1 = $row ['iva1'];
$total = $row ['total'];
$informemensualprovedores = $row ['informe_mensual_provedores'];
$orden_de_factura = $row ['orden_de_factura'];
$numero_facturacion = $row ['numero_facturacion'];
$valorfacturado = $row ['valorfacturado'];
$porcentaje_retencion = $row ['porcentaje_retencion'];
$valor_aprobado_para_pago = $row ['valor_aprobado_para_pago'];
$iva2 = $row ['iva2'];
$cree = $row ['cree'];
$retencion = $row ['retencion'];
$ica = $row ['ica'];
$neto_pagado = $row ['neto_pagado'];
$saldo_pendiente_pago = $row ['saldo_pendiente_pago'];
$observaciones = $row ['observaciones'];
$fecha = $row ['fecha'];
$pendiente = $row ['pendiente'];
$componente = $row ['componente'];
$grupo = $row ['grupo'];
$vertical = $row ['vertical'];
$fechaaprobacion = $row ['fechaaprobacion'];
$fechalegalizacion = $row ['fechalegalizacion'];
}
if ($pendiente=="Con numero de orden") {
$pendiente1="Con numero de orden";
$vpendiente1="0";
$pendiente2="pendiente";
$vpendiente2="1";
}
if ($pendiente=="pendiente") {
$pendiente1="pendiente";
$vpendiente1="1";
$pendiente2="Con numero de orden";
$vpendiente2="0";
}
if ($aplica_iva=="NO") {
$aplicaiva='NO';
$aplicaivavalor=0;
$aplicaiva1='SI';
$aplicaivavalor1=16;
}
if ($aplica_iva=="SI") {
$aplicaiva='SI';
$aplicaivavalor="16";
$aplicaiva1='NO';
$aplicaivavalor1="0";
}
if ($aplica_iva=="") {
$aplicaiva='NO';
$aplicaivavalor=0;
$aplicaiva1='SI';
$aplicaivavalor1=16;
}
if ($informemensualprovedores=='LEGALIZADO')
{
$informetxt="LEGALIZADO";
$informevalue="LEGALIZADO";
$informetxt1="SIN LEGALIZAR";
$informevalue1="SIN LEGALIZAR";
}
if ($informemensualprovedores=='SIN LEGALIZAR')
{
$informetxt="SIN LEGALIZAR";
$informevalue="SIN LEGALIZAR";
$informetxt1="LEGALIZADO";
$informevalue1="LEGALIZADO";
}
if ($informemensualprovedores=="")
{
$informetxt="SIN LEGALIZAR";
$informevalue="SIN LEGALIZAR";
$informetxt1="LEGALIZADO";
$informevalue1="LEGALIZADO";
}
if ($estado=="APROBADA")
{
$vcolor1='red';
$txt1='APROBADA';
$vcolor2='blue';
$txt2='GLOSADA';
$vcolor3='green';
$txt3='ACEPTADA';
$vcolor4='ANULADO';
$txt4='ANULADO';
}
if ($estado=="ACEPTADA")
{
$vcolor2='red';
$txt2='APROBADA';
/*red-aprobado */
$vcolor3='blue';
$txt3='GLOSADA';
$vcolor1='green';
$txt1='ACEPTADA';
$vcolor4='ANULADO';
$txt4='ANULADO';
}
if ($estado=="GLOSADA")
{
$vcolor3='red';
$txt3='APROBADA';
$vcolor1='blue';
$txt1='GLOSADA';
$vcolor2='green';
$txt2='ACEPTADA';
$vcolor4='ANULADO';
$txt4='ANULADO';
}
if ($estado=="ANULADO")
{
$vcolor4='red';
$txt4='APROBADA';
$vcolor3='blue';
$txt3='GLOSADA';
$vcolor2='green';
$txt2='ACEPTADA';
$vcolor1='ANULADO';
$txt1='ANULADO';
}
if ($estado=="")
{
$vcolor4='red';
$txt4='APROBADA';
$vcolor3='blue';
$txt3='GLOSADA';
$vcolor2='green';
$txt2='ACEPTADA';
$vcolor1='ANULADO';
$txt1='ANULADO';
}
//retencion//
if ($porcentaje_retencion==10)
{
$retencion1=10;
$txtretencion1="10%";
$retencion2=2.5;
$txtretencion2="2.5%";
$retencion3=11;
$txtretencion3="11%";
$retencion4=0;
$txtretencion4="0";
}
if ($porcentaje_retencion==2.5)
{
$retencion2='10';
$txtretencion2='10%';
$retencion1='2.5';
$txtretencion1='2.5%';
$retencion3='11';
$txtretencion3='11%';
$retencion4='0';
$txtretencion4='';
}
if ($porcentaje_retencion==11)
{
$retencion3='10';
$txtretencion3='10%';
$retencion2='2.5';
$txtretencion2='2.5%';
$retencion1='11';
$txtretencion1='11%';
$retencion4='0';
$txtretencion4='';
}
if ($porcentaje_retencion==0)
{
$retencion4="10";
$txtretencion4="10%";
$retencion2="2.5";
$txtretencion2="2.5%";
$retencion3="11";
$txtretencion3="11%";
$retencion1="0";
$txtretencion1="";
}
//facturacion//
if ($facturacion=="SIN FACTURAR") {
$facturacion1="0";
$facturado1="SIN FACTURAR";
$facturacion2="16";
$facturado2="FACTURADO";
}
if ($facturacion=="FACTURADA") {
$facturacion1="16";
$facturado1="FACTURADO";
$facturacion2="0";
$facturado2="SIN FACTURAR";
}
if ($facturacion=="") {
$facturacion1="0";
$facturado1="SIN FACTURAR";
$facturacion2="16";
$facturado2="FACTURADO";
}
// gestion de pago//
if ($gestion_de_pago=="ORDEN DE PAGO") {
$valorordenp="15";
$txtordenp='ORDEN DE PAGO';
$valorordenp1="0";
$txtordenp1='DEVUELTA';
$valorordenp3="SELECCIONE";
$txtordenp3='SELECCIONE';
...