(1369,'mod/app_ventas/index.php','2025-02-14 12:52:00','rafael',316,14615,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,2,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1370,'mod/app_ventas/index.php','2025-02-14 12:52:00','rafael',316,14614,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1371,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:53:00','rafael',426,10655,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\" text-align=\"right\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td><span><?php echo  $venta[\"total_mecanico\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1372,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:53:00','rafael',426,10637,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td text-align=\"right\"><span><?php echo  $venta[\"total_mecanico\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1373,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:53:00','rafael',426,10674,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td text-align=\"right\"><span text-align=\"right\"><?php echo  $venta[\"total_mecanico\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1374,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:55:00','rafael',426,10665,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td style=\"text-align: \'right\';\"><span><?php echo  $venta[\"total_mecanico\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1375,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:55:00','rafael',426,10637,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td><span style=\"text-align: \'right\';\"><?php echo  $venta[\"total_mecanico\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1376,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:55:00','rafael',426,10676,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td><span style=\"text-align: \'right\'; !important\"><?php echo  $venta[\"total_mecanico\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1377,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:56:00','rafael',426,10663,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><span><?php echo  $venta[\"id\"] ?></span></td>\n               <td><span><?php echo  $venta[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre_completo\"] ?></span></td>\n               <td><span><?php echo  $venta[\"nombre\"] ?></span></td>\n               <td style=\"text-align: \'right\'; !important\"><?php echo  $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1378,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:57:00','rafael',426,10611,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo  $venta[\"id\"] ?></td>\n               <td><?php echo  $venta[\"fecha\"] ?></td>\n               <td><?php echo  $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo  $venta[\"nombre\"] ?></td>\n               <td style=\"text-align: \'right\'; !important\"><?php echo  $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1379,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:58:00','rafael',426,10584,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo  $venta[\"id\"] ?></td>\n               <td><?php echo  $venta[\"fecha\"] ?></td>\n               <td><?php echo  $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo  $venta[\"nombre\"] ?></td>\n               <td align=\"right\"><?php echo  $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1380,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:58:00','rafael',426,10585,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo  $venta[\"id\"] ?></td>\n               <td><?php echo  $venta[\"fecha\"] ?></td>\n               <td><?php echo  $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo  $venta[\"nombre\"] ?></td>\n               <td align=\"right\"><?php echo  $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1381,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 12:58:00','rafael',426,10607,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo  $venta[\"id\"] ?></td>\n               <td><?php echo  $venta[\"fecha\"] ?></td>\n               <td><?php echo  $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo  $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\'; !important\"><?php echo  $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1382,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 13:00:00','rafael',426,10611,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo  $venta[\"id\"] ?></td>\n               <td><?php echo  $venta[\"fecha\"] ?></td>\n               <td><?php echo  $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo  $venta[\"nombre\"] ?></td>\n               <td style=\"text-align: \'right\'; !important\"><?php echo  $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1383,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 13:02:00','rafael',426,10606,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"text-align: \'right\'; !important\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1384,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 13:03:00','rafael',426,10607,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"text-align: \'right\'; !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1385,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 13:03:00','rafael',426,10606,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"text-align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1386,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 13:03:00','rafael',426,10604,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1387,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 13:03:00','rafael',426,10601,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1388,'core_formulario[16].javascript','2025-02-14 14:15:00','rafael',33,1219,'function cargarInformeAbono() {\n    $(\'#informeabono\').html(PCO_ObtenerContenidoAjax(0, \'index.php\',\n        \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=inf:40:0&id=\' + $(\'#id\').val())\n    );\n}\n\nfunction FrmAutoRun()\n    {\n        \n        if($(\'#id\').val()) {\n            $(\'#PCOContenedor_btn_consultar\').hide();\n            $(\'#PCOContenedor_fecha_inicio\').hide();\n            $(\'#PCOContenedor_fecha_fin\').hide();\n            $(\'#PCOContenedor_ventasCredito\').hide();\n            cargarInformeAbono();\n        }\n        else {\n            $(\'#PCOContenedor_btn_update\').hide();\n            $(\'#PCOContenedor_factura_pagada\').hide();\n            $(\'#PCOContenedor_fecha_pago\').hide();\n            $(\'#PCOContenedor_forma_pago\').hide();\n            $(\'#PCOContenedor_total\').hide();\n            $(\'#PCOContenedor_abono\').hide();\n            $(\'#PCOContenedor_informeabono\').hide();\n            \n        }\n        \n        if(!$(\'#fecha_inicio\').val()) $(\'#fecha_inicio\').val($(\'#fecha\').val());\n        if(!$(\'#fecha_fin\').val())    $(\'#fecha_fin\').val($(\'#fecha\').val());\n        if(!$(\'#cliente_credito\').val())    $(\'#cliente_credito\').val($(\'#cliente\').val());\n   \n		\n    }','B'),(1389,'core_formulario[16].post_script','2025-02-14 14:18:00','rafael',15,438,'<?php\nglobal $PCO_PostAccionDirecta, $fecha_inicio, $fecha_final, $cliente, $id, $accionForm;\n$PCO_PostAccionDirecta = 1;\n//$PCO_PostAccion = 1;\n$accionForm = \"se ha consultado\";\n\n\n\nif($id)\n    $accionForm = \"Actualizado\";\nPCO_Mensaje(\"Aviso del sistema\",\"La venta $accionForm correctamente!\", \'\', \'fa fa-thumbs-up fa-5x icon-green texto-blink\', \'alert alert-success alert-dismissible\');\n\nunset($GLOBALS[\'id\']);\n\nPCO_CargarFormulario(16);','B'),(1390,'core_formulario[8].javascript','2025-02-14 16:11:00','rafael',397,14426,'const { \n    id_cliente, id_producto, cantidad, numero_documento, telefono, nombre_completo, hora_inicio, hora_fin, guaje,\n    id, idClienteDB, total_fake, dinero_entregado, devuelta, tipo_venta, id_mecanico, placa, tipo_pago, precio, estado\n} = document.datos;\n\nconst lavado = 1;\nconst producto = 2;\nconst servicio = 3;\n\nconst formatter = (n, d = 2) => new Intl.NumberFormat(\'es-MX\').format(n);\n\nfunction isMobileDevice() {\n  return /Mobi|Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent);\n}\n\nfunction actualizarInforme() {\n    $(\'#informeCompra\').html(PCO_ObtenerContenidoAjax(0, \'index.php\',\n        \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=inf:11:0&id=\' + id.value)\n    );\n}\n\nfunction cargarDatosFE(resp) {\n    const { total, iva } = resp;\n    total_fake.value = formatter(total).replace(\'$\',\'\');\n    // iva_fake.value = formatter(iva).replace(\'$\',\'\');\n    /* if(!id.value && resp.id)\n        id.value = resp.id; */\n    actualizarInforme();\n}\n\nfunction calcularTiempo() {\n    const horaInicio = $(\'#hora_inicio\').val();\n    const horaFin = $(\'#hora_fin\').val();\n    if (!horaInicio || !horaFin) return;\n    const hiMom = moment(horaInicio, \"hh:mm:ss\");\n    const hfMom = moment(horaFin, \"hh:mm:ss\");\n    const duration = moment.duration(hfMom.diff(hiMom));\n    const minutes = duration.asHours() || 0;\n    $(\'#cantidad\').val((minutes).toFixed(2));\n}\n\nfunction consultarTotalVenta() {\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_consultarTotalVenta\' +\n            \'&id=\' + id.value\n        )\n    );\n    if(resp.success) {\n        cargarDatosFE(resp);\n    }\n    else {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n    }    \n}\n\nfunction FrmAutoRun()\n    {\n        document.title = \"Realizar venta\";\n        $(\'#PCOContenedor_id_mecanico\').hide();\n        $(\'#PCOContenedor_hora_inicio\').hide();\n        $(\'#PCOContenedor_hora_fin\').hide();\n        $(\'#PCOContenedor_guaje\').hide();\n        $(\'#PCOContenedor_factura_pagada\').hide();\n        $(\'#PCOContenedor_firma\').hide();\n\n        if($(\'#id\').val()) {\n            //$(\'#add_product\').hide();\n            $(\'#PCOContenedor_clientesSubForm\').hide();\n            // $(\'#id_cliente\').val(idClienteDB.value);\n            // PCOJS_ActualizarComboBox(\'id_cliente\');\n           actualizarInforme();\n          if($(\'#id_cliente\').val() == 1) {\n                $(\'#PCOContenedor_placa\').show();\n            } else {\n                $(\'#PCOContenedor_placa\').hide();\n            }\n            onChangeTipoProducto();\n            consultarTotalVenta();\n        }\n        else {\n            $(\'#finalizar_venta\').hide();\n            $(\'#btn_update\').hide();\n            $(\'#PCOContenedor_placa\').hide();\n        }\n        \n        if (isMobileDevice()) {\n          $(\'#CANVAS_firma\').width(250);\n          $(\'#CANVAS_firma\').height(150);\n        }\n    }\n\n function onchangeCliente(){\n    $(\'#PCOContenedor_placa\').show();\n    if($(\'#id_cliente\').val() == 1) {\n        $(\'#PCOContenedor_placa\').show();\n    } \n} \n\nfunction agregarProducto() {\n    console.log(\"id value\", id.value);\n    if(validarDatosCompra()) {\n        if(!id.value) {\n            document.datos.PCO_Accion.value = \'VENTA_agregarProductoCrearOC\';\n            document.datos.Precarga_EstilosBS.value = 1;\n            document.datos.Presentar_FullScreen.value = 0;\n            document.datos.target = \'_self\';\n        	document.datos.submit();\n        }\n        else {\n            const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n                \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_agregarProducto\' +\n                    \'&id=\' + id.value + \n                    \'&id_cliente=\' + id_cliente.value +\n                    \'&id_producto=\' + id_producto.value +\n                    \'&cantidad=\' + cantidad.value +\n                    \'&precioVenta=\' + precio.value +\n                    \'&nombre_completo=\' + nombre_completo.value +\n                    \'&telefono=\' + telefono.value +\n                    \'&hora_inicio=\' + hora_inicio.value +\n                    \'&hora_fin=\' + hora_fin.value +\n                    \'&guaje=\' + guaje.value +\n                    \'&numero_documento=\' + numero_documento.value\n                )\n            );\n            if(resp.success) {\n                cargarDatosFE(resp);\n                $(\'#finalizar_venta\').show();\n                $(\'#id_producto\').val(\'\');\n                PCOJS_ActualizarComboBox(\'id_producto\');\n                $(\'#precio\').val(\'\');\n                $(\'#cantidad\').val(\'1\');\n            }\n            else {\n                PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n            }\n        }\n    }\n}\n\nfunction mostrarMensajePopUp(TituloPopUp, Mensaje) {\n    $(\'#modalMensajeTitulo\').html(TituloPopUp);\n	$(\'#modalMensajeCuerpo\').html(Mensaje);\n\n    //Retira cualquier clase preexistente o remanente de cualquier personalizacion previa y agrega las clases base\n    $(\"#modalMensaje\").removeClass();\n    $( \"#modalMensaje\" ).addClass( \"modal\" );\n    $( \"#modalMensaje\" ).addClass( \"fade\" );\n    $( \"#modalMensaje\" ).addClass( \"oculto_impresion\" );\n\n    //Agrega las clases personalizadas por el usuario\n    /* if (ClasesAdicionales!=\"\")\n        $( \"#modalMensaje\" ).addClass( ClasesAdicionales ); */\n\n	// Se muestra el cuadro modal\n	$(\'#modalMensaje\').modal(\'show\');\n\n	//Hacer que la ventana este siempre por encima\n	$(\"#modalMensaje\").css(\"z-index\", \"1500\");\n}\n\nfunction editProduct() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent,cant,prec] = product.split(\'|\');\n    /* PCOJS_MostrarMensajeCargando(\"Editar producto\", PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    )); */\n    mostrarMensajePopUp(\'Editar producto\', PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    ));\n\n}\n\nfunction finalizarEdicionProducto() {\n    $(\'#modalMensaje\').modal(\'hide\');\n	$(\'#modalMensaje\').hide();\n    consultarTotalVenta();\n    actualizarInforme();\n}\n\nfunction actualizarProducto2()\n    {\n        if(!$(\'#id2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Venta\", \"No estas trabajando sobre una venta\");\n            return;\n        }\n        if(!$(\'#cantidad2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Cantidad\", \"La cantidad es obligatoria\");\n            return;\n        }\n        if(!$(\'#precio2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Precio\", \"El precio es obligatorio\");\n            return;\n        }\n        const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n            \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_actualizarProductoVenta\' +\n                \'&id=\' + $(\'#id2\').val() + \n                \'&id_producto=\' + $(\'#id_producto2\').val()  +\n                \'&cantidad=\' + $(\'#cantidad2\').val() +\n                \'&precio=\' + $(\'#precio2\').val()\n            )\n        );\n        finalizarEdicionProducto();\n    }\n\nfunction finalizarCompra() {\n    /*if(tipo_pago.value != \'Credito\' && dinero_entregado.value < total_fake.value) {\n        PCOJS_MostrarMensaje(\"Editar producto\", \"El valor a pagar es menor al total!\");\n        return;\n    }*/\n    actualizar_CANVAS_firma();\n    estado.value = 1;\n    //Actualiza\n        /*document.datos.PCO_Accion.value = \'PCO_ActualizarDatosFormulario\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n    //Abre la venta para imprimirla\n        /*document.datos.PCO_Accion.value = \'VENTA_imprimirFactura\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n\n    document.datos.PCO_Accion.value=\'PCO_ActualizarDatosFormulario\';\n    PCOJS_ValidarCamposYProcesarFormulario(\'datos\');\n}\n\nfunction eliminar_producto() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent] = product.split(\'|\');\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_eliminarProducto\' +\n            \'&id_venta=\' + id.value +\n            \'&id_venta_detalle=\' + idVent\n        )\n    );\n    cargarDatosFE(resp);\n}\n\nfunction validarDatosCompra() {\n    if(!id_cliente.value && !nombre_completo.value && !numero_documento.value && !telefono.value && id_cliente.value != 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    }\n    if(!cantidad.value || isNaN(cantidad.value) || cantidad.value < 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una cantidad válida!\");\n        return false;\n    }\n    if(!id_producto.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un producto\");\n        return false;\n    }\n    if(id_cliente.value == 1 && !placa.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una placa\");\n        return false;\n    }\n    if(tipo_venta.value == servicio && !id_mecanico.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un mecánico\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && (!hora_inicio.value || !hora_fin.value)) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar una hora inicio y hora fin\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && !guaje.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un guaje\");\n        return false;\n    }\n    if(!precio.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar un precio al producto\");\n        return false;\n    }\n    return true;\n}\n\nconst convertToInt = (n) => parseInt(n.replace(/,/g, \"\"));\n\nfunction calcularDevuelta() {\n    devuelta.value = \'\';\n    if(dinero_entregado.value && total_fake.value) {\n        dinero_entregado.value = dinero_entregado.value.replace(/\\D/g, \"\")\n            .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n        const diff = convertToInt(dinero_entregado.value) - convertToInt(total_fake.value);\n        //console.log({diff});\n        devuelta.value = formatter(diff).replace(\'$\', \'\');\n    }\n}\n/*\n        $(event.target).val(function (index, value ) {\n            return value.replace(/\\D/g, \"\")\n                        .replace(/([0-9])([0-9]{2})$/, \'$1.$2\')\n                        .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n*/\n\nconst origenListaOpciones = ({ PCO_TablaConsulta, PCO_ListaCamposRetorno, PCO_ListaCamposBusqueda, PCO_CondicionFiltrado }) => ({\n      values: \"a, b, c\",\n      ajax: {\n        url: \"index.php\",\n        type: \"POST\",\n        dataType: \"json\",\n        data: {\n          q: \"{{{q}}}\",\n          PCO_Accion: \"PCO_ObtenerOpcionesAjaxSelect\",\n          Presentar_FullScreen: \"1\",\n          PCO_TablaConsulta,\n          PCO_ListaCamposRetorno,\n          PCO_ListaCamposBusqueda,\n          PCO_CondicionFiltrado\n        }\n      },\n      minLength: 3,\n      locale: {\n        emptyTitle: \"Seleccione y digite para buscar\",\n        statusInitialized: \"Empiece a digitar para recuperar registros\",\n        statusSearching: \"Cargando...\",\n        currentlySelected: \"Actualmente seleccionado(s):\",\n        errorText: \"No se pueden recuperar registros\",\n        statusTooShort: \"Ingrese al menos tres caracteres\",\n        statusNoResults: \"No se encuentran resultados\",\n        searchPlaceholder: \"Buscar...\"\n      },\n      log: 0,\n      preprocessData: (data) => data.length ? data.map(({ T: text, V: value, S: subtext, I: icon }) => ({\n        text,\n        value,\n        data: {\n          subtext,\n          icon,\n        }\n        })) : []\n});\n\nfunction onChangeTipoProducto() {\n    $(\'#PCOContenedor_id_mecanico\').hide();\n    if(tipo_venta.value == servicio) $(\'#PCOContenedor_id_mecanico\').show();\n\n    $(\'#PCOContenedor_hora_inicio\').hide();\n    $(\'#PCOContenedor_hora_fin\').hide();\n    $(\'#PCOContenedor_guaje\').hide();\n    if(tipo_venta.value == lavado) {\n        $(\'#PCOContenedor_hora_fin\').show();\n        $(\'#PCOContenedor_hora_inicio\').show();\n        $(\'#PCOContenedor_guaje\').show();\n    }\n\n    // const filtradoProductos = tipo_venta.value == 2 ? \" AND inventario>0\" : \"\";\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            PCO_CondicionFiltrado: \"AND tipo_producto=\"+tipo_venta.value,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n}\n\nfunction getProduct() {\n    if(!id_producto.value || tipo_venta.value != lavado) return;\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PRODUCTOS_getProductById\' +\n            \'&id=\' + $(\'#id_producto\').val()\n        )\n    );\n    $(\'#precio\').val(resp.precio_venta || \"\")\n}\n\nfunction onchangeTipoPago() {\n    $(\'#PCOContenedor_factura_pagada\').hide();\n    $(\'#PCOContenedor_firma\').hide();\n    if(tipo_pago.value == \"Credito\") {\n        $(\'#PCOContenedor_factura_pagada\').show();\n        $(\'#PCOContenedor_firma\').show();\n    }\n}\n\n$(\'#DatePicker_hora_inicio\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n$(\'#DatePicker_hora_fin\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n\n/* $(document).ready(() => {\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre,\' | \',precio_venta)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            // PCO_CondicionFiltrado: \"tipo_producto=\"+$(\'#tipo_venta\').val()+filtradoProductos,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n});*/','B'),(1391,'core_formulario[8].javascript','2025-02-14 16:17:00','rafael',397,14438,'const { \n    id_cliente, id_producto, cantidad, numero_documento, telefono, nombre_completo, hora_inicio, hora_fin, guaje,\n    id, idClienteDB, total_fake, dinero_entregado, devuelta, tipo_venta, id_mecanico, placa, tipo_pago, precio, estado\n} = document.datos;\n\nconst lavado = 1;\nconst producto = 2;\nconst servicio = 3;\n\nconst formatter = (n, d = 2) => new Intl.NumberFormat(\'es-MX\').format(n);\n\nfunction isMobileDevice() {\n  return /Mobi|Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent);\n}\n\nfunction actualizarInforme() {\n    $(\'#informeCompra\').html(PCO_ObtenerContenidoAjax(0, \'index.php\',\n        \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=inf:11:0&id=\' + id.value)\n    );\n}\n\nfunction cargarDatosFE(resp) {\n    const { total, iva } = resp;\n    total_fake.value = formatter(total).replace(\'$\',\'\');\n    // iva_fake.value = formatter(iva).replace(\'$\',\'\');\n    /* if(!id.value && resp.id)\n        id.value = resp.id; */\n    actualizarInforme();\n}\n\nfunction calcularTiempo() {\n    const horaInicio = $(\'#hora_inicio\').val();\n    const horaFin = $(\'#hora_fin\').val();\n    if (!horaInicio || !horaFin) return;\n    const hiMom = moment(horaInicio, \"hh:mm:ss\");\n    const hfMom = moment(horaFin, \"hh:mm:ss\");\n    const duration = moment.duration(hfMom.diff(hiMom));\n    const minutes = duration.asHours() || 0;\n    $(\'#cantidad\').val((minutes).toFixed(2));\n}\n\nfunction consultarTotalVenta() {\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_consultarTotalVenta\' +\n            \'&id=\' + id.value\n        )\n    );\n    if(resp.success) {\n        cargarDatosFE(resp);\n    }\n    else {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n    }    \n}\n\nfunction FrmAutoRun()\n    {\n        document.title = \"Realizar venta\";\n        $(\'#PCOContenedor_id_mecanico\').hide();\n        $(\'#PCOContenedor_hora_inicio\').hide();\n        $(\'#PCOContenedor_hora_fin\').hide();\n        $(\'#PCOContenedor_guaje\').hide();\n        $(\'#PCOContenedor_factura_pagada\').hide();\n        $(\'#PCOContenedor_firma\').hide();\n\n        if($(\'#id\').val()) {\n            //$(\'#add_product\').hide();\n            $(\'#PCOContenedor_clientesSubForm\').hide();\n            // $(\'#id_cliente\').val(idClienteDB.value);\n            // PCOJS_ActualizarComboBox(\'id_cliente\');\n           actualizarInforme();\n          if($(\'#id_cliente\').val() == 1) {\n                $(\'#PCOContenedor_placa\').show();\n            } else {\n                $(\'#PCOContenedor_placa\').hide();\n            }\n            onChangeTipoProducto();\n            consultarTotalVenta();\n        }\n        else {\n            $(\'#finalizar_venta\').hide();\n            $(\'#btn_update\').hide();\n            $(\'#PCOContenedor_placa\').hide();\n        }\n        \n        if (isMobileDevice()) {\n          $(\'#CANVAS_firma\').width(250);\n          $(\'#CANVAS_firma\').height(150);\n        }\n    }\n\n function onchangeCliente(){\n    $(\'#PCOContenedor_placa\').show();\n    if($(\'#id_cliente\').val() == 1) {\n        $(\'#PCOContenedor_placa\').show();\n    } \n} \n\nfunction agregarProducto() {\n    if(validarDatosCompra()) {\n        if(!id.value) {\n                console.log(\"id value\", id.value);\n            document.datos.PCO_Accion.value = \'VENTA_agregarProductoCrearOC\';\n            document.datos.Precarga_EstilosBS.value = 1;\n            document.datos.Presentar_FullScreen.value = 0;\n            document.datos.target = \'_self\';\n        	document.datos.submit();\n        }\n        else {\n            const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n                \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_agregarProducto\' +\n                    \'&id=\' + id.value + \n                    \'&id_cliente=\' + id_cliente.value +\n                    \'&id_producto=\' + id_producto.value +\n                    \'&cantidad=\' + cantidad.value +\n                    \'&precioVenta=\' + precio.value +\n                    \'&nombre_completo=\' + nombre_completo.value +\n                    \'&telefono=\' + telefono.value +\n                    \'&hora_inicio=\' + hora_inicio.value +\n                    \'&hora_fin=\' + hora_fin.value +\n                    \'&guaje=\' + guaje.value +\n                    \'&numero_documento=\' + numero_documento.value\n                )\n            );\n            if(resp.success) {\n                cargarDatosFE(resp);\n                $(\'#finalizar_venta\').show();\n                $(\'#id_producto\').val(\'\');\n                PCOJS_ActualizarComboBox(\'id_producto\');\n                $(\'#precio\').val(\'\');\n                $(\'#cantidad\').val(\'1\');\n            }\n            else {\n                PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n            }\n        }\n    }\n}\n\nfunction mostrarMensajePopUp(TituloPopUp, Mensaje) {\n    $(\'#modalMensajeTitulo\').html(TituloPopUp);\n	$(\'#modalMensajeCuerpo\').html(Mensaje);\n\n    //Retira cualquier clase preexistente o remanente de cualquier personalizacion previa y agrega las clases base\n    $(\"#modalMensaje\").removeClass();\n    $( \"#modalMensaje\" ).addClass( \"modal\" );\n    $( \"#modalMensaje\" ).addClass( \"fade\" );\n    $( \"#modalMensaje\" ).addClass( \"oculto_impresion\" );\n\n    //Agrega las clases personalizadas por el usuario\n    /* if (ClasesAdicionales!=\"\")\n        $( \"#modalMensaje\" ).addClass( ClasesAdicionales ); */\n\n	// Se muestra el cuadro modal\n	$(\'#modalMensaje\').modal(\'show\');\n\n	//Hacer que la ventana este siempre por encima\n	$(\"#modalMensaje\").css(\"z-index\", \"1500\");\n}\n\nfunction editProduct() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent,cant,prec] = product.split(\'|\');\n    /* PCOJS_MostrarMensajeCargando(\"Editar producto\", PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    )); */\n    mostrarMensajePopUp(\'Editar producto\', PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    ));\n\n}\n\nfunction finalizarEdicionProducto() {\n    $(\'#modalMensaje\').modal(\'hide\');\n	$(\'#modalMensaje\').hide();\n    consultarTotalVenta();\n    actualizarInforme();\n}\n\nfunction actualizarProducto2()\n    {\n        if(!$(\'#id2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Venta\", \"No estas trabajando sobre una venta\");\n            return;\n        }\n        if(!$(\'#cantidad2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Cantidad\", \"La cantidad es obligatoria\");\n            return;\n        }\n        if(!$(\'#precio2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Precio\", \"El precio es obligatorio\");\n            return;\n        }\n        const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n            \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_actualizarProductoVenta\' +\n                \'&id=\' + $(\'#id2\').val() + \n                \'&id_producto=\' + $(\'#id_producto2\').val()  +\n                \'&cantidad=\' + $(\'#cantidad2\').val() +\n                \'&precio=\' + $(\'#precio2\').val()\n            )\n        );\n        finalizarEdicionProducto();\n    }\n\nfunction finalizarCompra() {\n    /*if(tipo_pago.value != \'Credito\' && dinero_entregado.value < total_fake.value) {\n        PCOJS_MostrarMensaje(\"Editar producto\", \"El valor a pagar es menor al total!\");\n        return;\n    }*/\n    actualizar_CANVAS_firma();\n    estado.value = 1;\n    //Actualiza\n        /*document.datos.PCO_Accion.value = \'PCO_ActualizarDatosFormulario\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n    //Abre la venta para imprimirla\n        /*document.datos.PCO_Accion.value = \'VENTA_imprimirFactura\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n\n    document.datos.PCO_Accion.value=\'PCO_ActualizarDatosFormulario\';\n    PCOJS_ValidarCamposYProcesarFormulario(\'datos\');\n}\n\nfunction eliminar_producto() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent] = product.split(\'|\');\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_eliminarProducto\' +\n            \'&id_venta=\' + id.value +\n            \'&id_venta_detalle=\' + idVent\n        )\n    );\n    cargarDatosFE(resp);\n}\n\nfunction validarDatosCompra() {\n    if(!id_cliente.value && !nombre_completo.value && !numero_documento.value && !telefono.value && id_cliente.value != 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    }\n    if(!cantidad.value || isNaN(cantidad.value) || cantidad.value < 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una cantidad válida!\");\n        return false;\n    }\n    if(!id_producto.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un producto\");\n        return false;\n    }\n    if(id_cliente.value == 1 && !placa.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una placa\");\n        return false;\n    }\n    if(tipo_venta.value == servicio && !id_mecanico.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un mecánico\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && (!hora_inicio.value || !hora_fin.value)) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar una hora inicio y hora fin\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && !guaje.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un guaje\");\n        return false;\n    }\n    if(!precio.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar un precio al producto\");\n        return false;\n    }\n    return true;\n}\n\nconst convertToInt = (n) => parseInt(n.replace(/,/g, \"\"));\n\nfunction calcularDevuelta() {\n    devuelta.value = \'\';\n    if(dinero_entregado.value && total_fake.value) {\n        dinero_entregado.value = dinero_entregado.value.replace(/\\D/g, \"\")\n            .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n        const diff = convertToInt(dinero_entregado.value) - convertToInt(total_fake.value);\n        //console.log({diff});\n        devuelta.value = formatter(diff).replace(\'$\', \'\');\n    }\n}\n/*\n        $(event.target).val(function (index, value ) {\n            return value.replace(/\\D/g, \"\")\n                        .replace(/([0-9])([0-9]{2})$/, \'$1.$2\')\n                        .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n*/\n\nconst origenListaOpciones = ({ PCO_TablaConsulta, PCO_ListaCamposRetorno, PCO_ListaCamposBusqueda, PCO_CondicionFiltrado }) => ({\n      values: \"a, b, c\",\n      ajax: {\n        url: \"index.php\",\n        type: \"POST\",\n        dataType: \"json\",\n        data: {\n          q: \"{{{q}}}\",\n          PCO_Accion: \"PCO_ObtenerOpcionesAjaxSelect\",\n          Presentar_FullScreen: \"1\",\n          PCO_TablaConsulta,\n          PCO_ListaCamposRetorno,\n          PCO_ListaCamposBusqueda,\n          PCO_CondicionFiltrado\n        }\n      },\n      minLength: 3,\n      locale: {\n        emptyTitle: \"Seleccione y digite para buscar\",\n        statusInitialized: \"Empiece a digitar para recuperar registros\",\n        statusSearching: \"Cargando...\",\n        currentlySelected: \"Actualmente seleccionado(s):\",\n        errorText: \"No se pueden recuperar registros\",\n        statusTooShort: \"Ingrese al menos tres caracteres\",\n        statusNoResults: \"No se encuentran resultados\",\n        searchPlaceholder: \"Buscar...\"\n      },\n      log: 0,\n      preprocessData: (data) => data.length ? data.map(({ T: text, V: value, S: subtext, I: icon }) => ({\n        text,\n        value,\n        data: {\n          subtext,\n          icon,\n        }\n        })) : []\n});\n\nfunction onChangeTipoProducto() {\n    $(\'#PCOContenedor_id_mecanico\').hide();\n    if(tipo_venta.value == servicio) $(\'#PCOContenedor_id_mecanico\').show();\n\n    $(\'#PCOContenedor_hora_inicio\').hide();\n    $(\'#PCOContenedor_hora_fin\').hide();\n    $(\'#PCOContenedor_guaje\').hide();\n    if(tipo_venta.value == lavado) {\n        $(\'#PCOContenedor_hora_fin\').show();\n        $(\'#PCOContenedor_hora_inicio\').show();\n        $(\'#PCOContenedor_guaje\').show();\n    }\n\n    // const filtradoProductos = tipo_venta.value == 2 ? \" AND inventario>0\" : \"\";\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            PCO_CondicionFiltrado: \"AND tipo_producto=\"+tipo_venta.value,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n}\n\nfunction getProduct() {\n    if(!id_producto.value || tipo_venta.value != lavado) return;\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PRODUCTOS_getProductById\' +\n            \'&id=\' + $(\'#id_producto\').val()\n        )\n    );\n    $(\'#precio\').val(resp.precio_venta || \"\")\n}\n\nfunction onchangeTipoPago() {\n    $(\'#PCOContenedor_factura_pagada\').hide();\n    $(\'#PCOContenedor_firma\').hide();\n    if(tipo_pago.value == \"Credito\") {\n        $(\'#PCOContenedor_factura_pagada\').show();\n        $(\'#PCOContenedor_firma\').show();\n    }\n}\n\n$(\'#DatePicker_hora_inicio\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n$(\'#DatePicker_hora_fin\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n\n/* $(document).ready(() => {\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre,\' | \',precio_venta)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            // PCO_CondicionFiltrado: \"tipo_producto=\"+$(\'#tipo_venta\').val()+filtradoProductos,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n});*/','B'),(1392,'core_formulario[8].javascript','2025-02-14 16:24:00','rafael',401,14595,'const { \n    id_cliente, id_producto, cantidad, numero_documento, telefono, nombre_completo, hora_inicio, hora_fin, guaje,\n    id, idClienteDB, total_fake, dinero_entregado, devuelta, tipo_venta, id_mecanico, placa, tipo_pago, precio, estado\n} = document.datos;\n\nconst lavado = 1;\nconst producto = 2;\nconst servicio = 3;\n\nconst formatter = (n, d = 2) => new Intl.NumberFormat(\'es-MX\').format(n);\n\nfunction isMobileDevice() {\n  return /Mobi|Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent);\n}\n\nfunction actualizarInforme() {\n    $(\'#informeCompra\').html(PCO_ObtenerContenidoAjax(0, \'index.php\',\n        \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=inf:11:0&id=\' + id.value)\n    );\n}\n\nfunction cargarDatosFE(resp) {\n    const { total, iva } = resp;\n    total_fake.value = formatter(total).replace(\'$\',\'\');\n    // iva_fake.value = formatter(iva).replace(\'$\',\'\');\n    /* if(!id.value && resp.id)\n        id.value = resp.id; */\n    actualizarInforme();\n}\n\nfunction calcularTiempo() {\n    const horaInicio = $(\'#hora_inicio\').val();\n    const horaFin = $(\'#hora_fin\').val();\n    if (!horaInicio || !horaFin) return;\n    const hiMom = moment(horaInicio, \"hh:mm:ss\");\n    const hfMom = moment(horaFin, \"hh:mm:ss\");\n    const duration = moment.duration(hfMom.diff(hiMom));\n    const minutes = duration.asHours() || 0;\n    $(\'#cantidad\').val((minutes).toFixed(2));\n}\n\nfunction consultarTotalVenta() {\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_consultarTotalVenta\' +\n            \'&id=\' + id.value\n        )\n    );\n    if(resp.success) {\n        cargarDatosFE(resp);\n    }\n    else {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n    }    \n}\n\nfunction FrmAutoRun()\n    {\n        document.title = \"Realizar venta\";\n        $(\'#PCOContenedor_id_mecanico\').hide();\n        $(\'#PCOContenedor_hora_inicio\').hide();\n        $(\'#PCOContenedor_hora_fin\').hide();\n        $(\'#PCOContenedor_guaje\').hide();\n        $(\'#PCOContenedor_factura_pagada\').hide();\n        $(\'#PCOContenedor_firma\').hide();\n\n        if($(\'#id\').val()) {\n            //$(\'#add_product\').hide();\n            $(\'#PCOContenedor_clientesSubForm\').hide();\n            // $(\'#id_cliente\').val(idClienteDB.value);\n            // PCOJS_ActualizarComboBox(\'id_cliente\');\n           actualizarInforme();\n          if($(\'#id_cliente\').val() == 1) {\n                $(\'#PCOContenedor_placa\').show();\n            } else {\n                $(\'#PCOContenedor_placa\').hide();\n            }\n            onChangeTipoProducto();\n            consultarTotalVenta();\n        }\n        else {\n            $(\'#finalizar_venta\').hide();\n            $(\'#btn_update\').hide();\n            $(\'#PCOContenedor_placa\').hide();\n        }\n        \n        if (isMobileDevice()) {\n          $(\'#CANVAS_firma\').width(250);\n          $(\'#CANVAS_firma\').height(150);\n        }\n    }\n\n function onchangeCliente(){\n    $(\'#PCOContenedor_placa\').show();\n    if($(\'#id_cliente\').val() == 1) {\n        $(\'#PCOContenedor_placa\').show();\n    } \n} \n\nfunction agregarProducto() {\n    if(validarDatosCompra()) {\n        if(!id.value) {\n                console.log(\"id value\", id.value);\n            document.datos.PCO_Accion.value = \'VENTA_agregarProductoCrearOC\';\n            document.datos.Precarga_EstilosBS.value = 1;\n            document.datos.Presentar_FullScreen.value = 0;\n            document.datos.target = \'_self\';\n        	document.datos.submit();\n        }\n        else {\n            const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n                \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_agregarProducto\' +\n                    \'&id=\' + id.value + \n                    \'&id_cliente=\' + id_cliente.value +\n                    \'&id_producto=\' + id_producto.value +\n                    \'&cantidad=\' + cantidad.value +\n                    \'&precioVenta=\' + precio.value +\n                    \'&nombre_completo=\' + nombre_completo.value +\n                    \'&telefono=\' + telefono.value +\n                    \'&hora_inicio=\' + hora_inicio.value +\n                    \'&hora_fin=\' + hora_fin.value +\n                    \'&guaje=\' + guaje.value +\n                    \'&numero_documento=\' + numero_documento.value\n                )\n            );\n            if(resp.success) {\n                cargarDatosFE(resp);\n                $(\'#finalizar_venta\').show();\n                $(\'#id_producto\').val(\'\');\n                PCOJS_ActualizarComboBox(\'id_producto\');\n                $(\'#precio\').val(\'\');\n                $(\'#cantidad\').val(\'1\');\n            }\n            else {\n                PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n            }\n        }\n    }\n}\n\nfunction mostrarMensajePopUp(TituloPopUp, Mensaje) {\n    $(\'#modalMensajeTitulo\').html(TituloPopUp);\n	$(\'#modalMensajeCuerpo\').html(Mensaje);\n\n    //Retira cualquier clase preexistente o remanente de cualquier personalizacion previa y agrega las clases base\n    $(\"#modalMensaje\").removeClass();\n    $( \"#modalMensaje\" ).addClass( \"modal\" );\n    $( \"#modalMensaje\" ).addClass( \"fade\" );\n    $( \"#modalMensaje\" ).addClass( \"oculto_impresion\" );\n\n    //Agrega las clases personalizadas por el usuario\n    /* if (ClasesAdicionales!=\"\")\n        $( \"#modalMensaje\" ).addClass( ClasesAdicionales ); */\n\n	// Se muestra el cuadro modal\n	$(\'#modalMensaje\').modal(\'show\');\n\n	//Hacer que la ventana este siempre por encima\n	$(\"#modalMensaje\").css(\"z-index\", \"1500\");\n}\n\nfunction editProduct() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent,cant,prec] = product.split(\'|\');\n    /* PCOJS_MostrarMensajeCargando(\"Editar producto\", PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    )); */\n    mostrarMensajePopUp(\'Editar producto\', PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    ));\n\n}\n\nfunction finalizarEdicionProducto() {\n    $(\'#modalMensaje\').modal(\'hide\');\n	$(\'#modalMensaje\').hide();\n    consultarTotalVenta();\n    actualizarInforme();\n}\n\nfunction actualizarProducto2()\n    {\n        if(!$(\'#id2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Venta\", \"No estas trabajando sobre una venta\");\n            return;\n        }\n        if(!$(\'#cantidad2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Cantidad\", \"La cantidad es obligatoria\");\n            return;\n        }\n        if(!$(\'#precio2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Precio\", \"El precio es obligatorio\");\n            return;\n        }\n        const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n            \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_actualizarProductoVenta\' +\n                \'&id=\' + $(\'#id2\').val() + \n                \'&id_producto=\' + $(\'#id_producto2\').val()  +\n                \'&cantidad=\' + $(\'#cantidad2\').val() +\n                \'&precio=\' + $(\'#precio2\').val()\n            )\n        );\n        finalizarEdicionProducto();\n    }\n\nfunction finalizarCompra() {\n    /*if(tipo_pago.value != \'Credito\' && dinero_entregado.value < total_fake.value) {\n        PCOJS_MostrarMensaje(\"Editar producto\", \"El valor a pagar es menor al total!\");\n        return;\n    }*/\n    actualizar_CANVAS_firma();\n    estado.value = 1;\n    //Actualiza\n        /*document.datos.PCO_Accion.value = \'PCO_ActualizarDatosFormulario\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n    //Abre la venta para imprimirla\n        /*document.datos.PCO_Accion.value = \'VENTA_imprimirFactura\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n\n    document.datos.PCO_Accion.value=\'PCO_ActualizarDatosFormulario\';\n    PCOJS_ValidarCamposYProcesarFormulario(\'datos\');\n}\n\nfunction eliminar_producto() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent] = product.split(\'|\');\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_eliminarProducto\' +\n            \'&id_venta=\' + id.value +\n            \'&id_venta_detalle=\' + idVent\n        )\n    );\n    cargarDatosFE(resp);\n}\n\nfunction validarDatosCompra() {\n    /* if(!id_cliente.value && !nombre_completo.value && !numero_documento.value && !telefono.value && id_cliente.value != 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    } */\n    if(!id_cliente.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    }\n    if(!cantidad.value || isNaN(cantidad.value) || cantidad.value < 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una cantidad válida!\");\n        return false;\n    }\n    if(!id_producto.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un producto\");\n        return false;\n    }\n    if(id_cliente.value == 1 && !placa.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una placa\");\n        return false;\n    }\n    if(tipo_venta.value == servicio && !id_mecanico.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un mecánico\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && (!hora_inicio.value || !hora_fin.value)) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar una hora inicio y hora fin\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && !guaje.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un guaje\");\n        return false;\n    }\n    if(!precio.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar un precio al producto\");\n        return false;\n    }\n    return true;\n}\n\nconst convertToInt = (n) => parseInt(n.replace(/,/g, \"\"));\n\nfunction calcularDevuelta() {\n    devuelta.value = \'\';\n    if(dinero_entregado.value && total_fake.value) {\n        dinero_entregado.value = dinero_entregado.value.replace(/\\D/g, \"\")\n            .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n        const diff = convertToInt(dinero_entregado.value) - convertToInt(total_fake.value);\n        //console.log({diff});\n        devuelta.value = formatter(diff).replace(\'$\', \'\');\n    }\n}\n/*\n        $(event.target).val(function (index, value ) {\n            return value.replace(/\\D/g, \"\")\n                        .replace(/([0-9])([0-9]{2})$/, \'$1.$2\')\n                        .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n*/\n\nconst origenListaOpciones = ({ PCO_TablaConsulta, PCO_ListaCamposRetorno, PCO_ListaCamposBusqueda, PCO_CondicionFiltrado }) => ({\n      values: \"a, b, c\",\n      ajax: {\n        url: \"index.php\",\n        type: \"POST\",\n        dataType: \"json\",\n        data: {\n          q: \"{{{q}}}\",\n          PCO_Accion: \"PCO_ObtenerOpcionesAjaxSelect\",\n          Presentar_FullScreen: \"1\",\n          PCO_TablaConsulta,\n          PCO_ListaCamposRetorno,\n          PCO_ListaCamposBusqueda,\n          PCO_CondicionFiltrado\n        }\n      },\n      minLength: 3,\n      locale: {\n        emptyTitle: \"Seleccione y digite para buscar\",\n        statusInitialized: \"Empiece a digitar para recuperar registros\",\n        statusSearching: \"Cargando...\",\n        currentlySelected: \"Actualmente seleccionado(s):\",\n        errorText: \"No se pueden recuperar registros\",\n        statusTooShort: \"Ingrese al menos tres caracteres\",\n        statusNoResults: \"No se encuentran resultados\",\n        searchPlaceholder: \"Buscar...\"\n      },\n      log: 0,\n      preprocessData: (data) => data.length ? data.map(({ T: text, V: value, S: subtext, I: icon }) => ({\n        text,\n        value,\n        data: {\n          subtext,\n          icon,\n        }\n        })) : []\n});\n\nfunction onChangeTipoProducto() {\n    $(\'#PCOContenedor_id_mecanico\').hide();\n    if(tipo_venta.value == servicio) $(\'#PCOContenedor_id_mecanico\').show();\n\n    $(\'#PCOContenedor_hora_inicio\').hide();\n    $(\'#PCOContenedor_hora_fin\').hide();\n    $(\'#PCOContenedor_guaje\').hide();\n    if(tipo_venta.value == lavado) {\n        $(\'#PCOContenedor_hora_fin\').show();\n        $(\'#PCOContenedor_hora_inicio\').show();\n        $(\'#PCOContenedor_guaje\').show();\n    }\n\n    // const filtradoProductos = tipo_venta.value == 2 ? \" AND inventario>0\" : \"\";\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            PCO_CondicionFiltrado: \"AND tipo_producto=\"+tipo_venta.value,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n}\n\nfunction getProduct() {\n    if(!id_producto.value || tipo_venta.value != lavado) return;\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PRODUCTOS_getProductById\' +\n            \'&id=\' + $(\'#id_producto\').val()\n        )\n    );\n    $(\'#precio\').val(resp.precio_venta || \"\")\n}\n\nfunction onchangeTipoPago() {\n    $(\'#PCOContenedor_factura_pagada\').hide();\n    $(\'#PCOContenedor_firma\').hide();\n    if(tipo_pago.value == \"Credito\") {\n        $(\'#PCOContenedor_factura_pagada\').show();\n        $(\'#PCOContenedor_firma\').show();\n    }\n}\n\n$(\'#DatePicker_hora_inicio\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n$(\'#DatePicker_hora_fin\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n\n/* $(document).ready(() => {\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre,\' | \',precio_venta)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            // PCO_CondicionFiltrado: \"tipo_producto=\"+$(\'#tipo_venta\').val()+filtradoProductos,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n});*/','B'),(1393,'core_formulario[8].javascript','2025-02-14 16:25:00','rafael',401,14595,'const { \n    id_cliente, id_producto, cantidad, numero_documento, telefono, nombre_completo, hora_inicio, hora_fin, guaje,\n    id, idClienteDB, total_fake, dinero_entregado, devuelta, tipo_venta, id_mecanico, placa, tipo_pago, precio, estado\n} = document.datos;\n\nconst lavado = 1;\nconst producto = 2;\nconst servicio = 3;\n\nconst formatter = (n, d = 2) => new Intl.NumberFormat(\'es-MX\').format(n);\n\nfunction isMobileDevice() {\n  return /Mobi|Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent);\n}\n\nfunction actualizarInforme() {\n    $(\'#informeCompra\').html(PCO_ObtenerContenidoAjax(0, \'index.php\',\n        \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=inf:11:0&id=\' + id.value)\n    );\n}\n\nfunction cargarDatosFE(resp) {\n    const { total, iva } = resp;\n    total_fake.value = formatter(total).replace(\'$\',\'\');\n    // iva_fake.value = formatter(iva).replace(\'$\',\'\');\n    /* if(!id.value && resp.id)\n        id.value = resp.id; */\n    actualizarInforme();\n}\n\nfunction calcularTiempo() {\n    const horaInicio = $(\'#hora_inicio\').val();\n    const horaFin = $(\'#hora_fin\').val();\n    if (!horaInicio || !horaFin) return;\n    const hiMom = moment(horaInicio, \"hh:mm:ss\");\n    const hfMom = moment(horaFin, \"hh:mm:ss\");\n    const duration = moment.duration(hfMom.diff(hiMom));\n    const minutes = duration.asHours() || 0;\n    $(\'#cantidad\').val((minutes).toFixed(2));\n}\n\nfunction consultarTotalVenta() {\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_consultarTotalVenta\' +\n            \'&id=\' + id.value\n        )\n    );\n    if(resp.success) {\n        cargarDatosFE(resp);\n    }\n    else {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n    }    \n}\n\nfunction FrmAutoRun()\n    {\n        document.title = \"Realizar venta\";\n        $(\'#PCOContenedor_id_mecanico\').hide();\n        $(\'#PCOContenedor_hora_inicio\').hide();\n        $(\'#PCOContenedor_hora_fin\').hide();\n        $(\'#PCOContenedor_guaje\').hide();\n        $(\'#PCOContenedor_factura_pagada\').hide();\n        $(\'#PCOContenedor_firma\').hide();\n\n        if($(\'#id\').val()) {\n            //$(\'#add_product\').hide();\n            $(\'#PCOContenedor_clientesSubForm\').hide();\n            // $(\'#id_cliente\').val(idClienteDB.value);\n            // PCOJS_ActualizarComboBox(\'id_cliente\');\n           actualizarInforme();\n          if($(\'#id_cliente\').val() == 1) {\n                $(\'#PCOContenedor_placa\').show();\n            } else {\n                $(\'#PCOContenedor_placa\').hide();\n            }\n            onChangeTipoProducto();\n            consultarTotalVenta();\n        }\n        else {\n            $(\'#finalizar_venta\').hide();\n            $(\'#btn_update\').hide();\n            $(\'#PCOContenedor_placa\').hide();\n        }\n        \n        if (isMobileDevice()) {\n          $(\'#CANVAS_firma\').width(250);\n          $(\'#CANVAS_firma\').height(150);\n        }\n    }\n\n function onchangeCliente(){\n    $(\'#PCOContenedor_placa\').show();\n    if($(\'#id_cliente\').val() == 1) {\n        $(\'#PCOContenedor_placa\').show();\n    } \n} \n\nfunction agregarProducto() {\n    if(validarDatosCompra()) {\n        if(!id.value) {\n                console.log(\"id value\", id.value);\n            document.datos.PCO_Accion.value = \'VENTA_agregarProductoCrearOC\';\n            document.datos.Precarga_EstilosBS.value = 1;\n            document.datos.Presentar_FullScreen.value = 0;\n            document.datos.target = \'_self\';\n        	document.datos.submit();\n        }\n        else {\n            const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n                \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_agregarProducto\' +\n                    \'&id=\' + id.value + \n                    \'&id_cliente=\' + id_cliente.value +\n                    \'&id_producto=\' + id_producto.value +\n                    \'&cantidad=\' + cantidad.value +\n                    \'&precioVenta=\' + precio.value +\n                    \'&nombre_completo=\' + nombre_completo.value +\n                    \'&telefono=\' + telefono.value +\n                    \'&hora_inicio=\' + hora_inicio.value +\n                    \'&hora_fin=\' + hora_fin.value +\n                    \'&guaje=\' + guaje.value +\n                    \'&numero_documento=\' + numero_documento.value\n                )\n            );\n            if(resp.success) {\n                cargarDatosFE(resp);\n                $(\'#finalizar_venta\').show();\n                $(\'#id_producto\').val(\'\');\n                PCOJS_ActualizarComboBox(\'id_producto\');\n                $(\'#precio\').val(\'\');\n                $(\'#cantidad\').val(\'1\');\n            }\n            else {\n                PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n            }\n        }\n    }\n}\n\nfunction mostrarMensajePopUp(TituloPopUp, Mensaje) {\n    $(\'#modalMensajeTitulo\').html(TituloPopUp);\n	$(\'#modalMensajeCuerpo\').html(Mensaje);\n\n    //Retira cualquier clase preexistente o remanente de cualquier personalizacion previa y agrega las clases base\n    $(\"#modalMensaje\").removeClass();\n    $( \"#modalMensaje\" ).addClass( \"modal\" );\n    $( \"#modalMensaje\" ).addClass( \"fade\" );\n    $( \"#modalMensaje\" ).addClass( \"oculto_impresion\" );\n\n    //Agrega las clases personalizadas por el usuario\n    /* if (ClasesAdicionales!=\"\")\n        $( \"#modalMensaje\" ).addClass( ClasesAdicionales ); */\n\n	// Se muestra el cuadro modal\n	$(\'#modalMensaje\').modal(\'show\');\n\n	//Hacer que la ventana este siempre por encima\n	$(\"#modalMensaje\").css(\"z-index\", \"1500\");\n}\n\nfunction editProduct() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent,cant,prec] = product.split(\'|\');\n    /* PCOJS_MostrarMensajeCargando(\"Editar producto\", PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    )); */\n    mostrarMensajePopUp(\'Editar producto\', PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    ));\n\n}\n\nfunction finalizarEdicionProducto() {\n    $(\'#modalMensaje\').modal(\'hide\');\n	$(\'#modalMensaje\').hide();\n    consultarTotalVenta();\n    actualizarInforme();\n}\n\nfunction actualizarProducto2()\n    {\n        if(!$(\'#id2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Venta\", \"No estas trabajando sobre una venta\");\n            return;\n        }\n        if(!$(\'#cantidad2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Cantidad\", \"La cantidad es obligatoria\");\n            return;\n        }\n        if(!$(\'#precio2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Precio\", \"El precio es obligatorio\");\n            return;\n        }\n        const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n            \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_actualizarProductoVenta\' +\n                \'&id=\' + $(\'#id2\').val() + \n                \'&id_producto=\' + $(\'#id_producto2\').val()  +\n                \'&cantidad=\' + $(\'#cantidad2\').val() +\n                \'&precio=\' + $(\'#precio2\').val()\n            )\n        );\n        finalizarEdicionProducto();\n    }\n\nfunction finalizarCompra() {\n    /*if(tipo_pago.value != \'Credito\' && dinero_entregado.value < total_fake.value) {\n        PCOJS_MostrarMensaje(\"Editar producto\", \"El valor a pagar es menor al total!\");\n        return;\n    }*/\n    actualizar_CANVAS_firma();\n    estado.value = 1;\n    //Actualiza\n        /*document.datos.PCO_Accion.value = \'PCO_ActualizarDatosFormulario\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n    //Abre la venta para imprimirla\n        /*document.datos.PCO_Accion.value = \'VENTA_imprimirFactura\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n\n    document.datos.PCO_Accion.value=\'PCO_ActualizarDatosFormulario\';\n    PCOJS_ValidarCamposYProcesarFormulario(\'datos\');\n}\n\nfunction eliminar_producto() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent] = product.split(\'|\');\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_eliminarProducto\' +\n            \'&id_venta=\' + id.value +\n            \'&id_venta_detalle=\' + idVent\n        )\n    );\n    cargarDatosFE(resp);\n}\n\nfunction validarDatosCompra() {\n    /* if(!id_cliente.value && !nombre_completo.value && !numero_documento.value && !telefono.value && id_cliente.value != 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    } */\n    if(!id_cliente.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    }\n    if(!cantidad.value || isNaN(cantidad.value) || cantidad.value < 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una cantidad válida!\");\n        return false;\n    }\n    if(!id_producto.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un producto\");\n        return false;\n    }\n    if(id_cliente.value == 1 && !placa.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una placa\");\n        return false;\n    }\n    if(tipo_venta.value == servicio && !id_mecanico.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un mecánico\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && (!hora_inicio.value || !hora_fin.value)) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar una hora inicio y hora fin\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && !guaje.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un guaje\");\n        return false;\n    }\n    if(!precio.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar un precio al producto\");\n        return false;\n    }\n    return true;\n}\n\nconst convertToInt = (n) => parseInt(n.replace(/,/g, \"\"));\n\nfunction calcularDevuelta() {\n    devuelta.value = \'\';\n    if(dinero_entregado.value && total_fake.value) {\n        dinero_entregado.value = dinero_entregado.value.replace(/\\D/g, \"\")\n            .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n        const diff = convertToInt(dinero_entregado.value) - convertToInt(total_fake.value);\n        //console.log({diff});\n        devuelta.value = formatter(diff).replace(\'$\', \'\');\n    }\n}\n/*\n        $(event.target).val(function (index, value ) {\n            return value.replace(/\\D/g, \"\")\n                        .replace(/([0-9])([0-9]{2})$/, \'$1.$2\')\n                        .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n*/\n\nconst origenListaOpciones = ({ PCO_TablaConsulta, PCO_ListaCamposRetorno, PCO_ListaCamposBusqueda, PCO_CondicionFiltrado }) => ({\n      values: \"a, b, c\",\n      ajax: {\n        url: \"index.php\",\n        type: \"POST\",\n        dataType: \"json\",\n        data: {\n          q: \"{{{q}}}\",\n          PCO_Accion: \"PCO_ObtenerOpcionesAjaxSelect\",\n          Presentar_FullScreen: \"1\",\n          PCO_TablaConsulta,\n          PCO_ListaCamposRetorno,\n          PCO_ListaCamposBusqueda,\n          PCO_CondicionFiltrado\n        }\n      },\n      minLength: 3,\n      locale: {\n        emptyTitle: \"Seleccione y digite para buscar\",\n        statusInitialized: \"Empiece a digitar para recuperar registros\",\n        statusSearching: \"Cargando...\",\n        currentlySelected: \"Actualmente seleccionado(s):\",\n        errorText: \"No se pueden recuperar registros\",\n        statusTooShort: \"Ingrese al menos tres caracteres\",\n        statusNoResults: \"No se encuentran resultados\",\n        searchPlaceholder: \"Buscar...\"\n      },\n      log: 0,\n      preprocessData: (data) => data.length ? data.map(({ T: text, V: value, S: subtext, I: icon }) => ({\n        text,\n        value,\n        data: {\n          subtext,\n          icon,\n        }\n        })) : []\n});\n\nfunction onChangeTipoProducto() {\n    $(\'#PCOContenedor_id_mecanico\').hide();\n    if(tipo_venta.value == servicio) $(\'#PCOContenedor_id_mecanico\').show();\n\n    $(\'#PCOContenedor_hora_inicio\').hide();\n    $(\'#PCOContenedor_hora_fin\').hide();\n    $(\'#PCOContenedor_guaje\').hide();\n    if(tipo_venta.value == lavado) {\n        $(\'#PCOContenedor_hora_fin\').show();\n        $(\'#PCOContenedor_hora_inicio\').show();\n        $(\'#PCOContenedor_guaje\').show();\n    }\n\n    // const filtradoProductos = tipo_venta.value == 2 ? \" AND inventario>0\" : \"\";\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            PCO_CondicionFiltrado: \"AND tipo_producto=\"+tipo_venta.value,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n}\n\nfunction getProduct() {\n    if(!id_producto.value || tipo_venta.value != lavado) return;\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PRODUCTOS_getProductById\' +\n            \'&id=\' + $(\'#id_producto\').val()\n        )\n    );\n    $(\'#precio\').val(resp.precio_venta || \"\")\n}\n\nfunction onchangeTipoPago() {\n    $(\'#PCOContenedor_factura_pagada\').hide();\n    $(\'#PCOContenedor_firma\').hide();\n    if(tipo_pago.value == \"Credito\") {\n        $(\'#PCOContenedor_factura_pagada\').show();\n        $(\'#PCOContenedor_firma\').show();\n    }\n}\n\n$(\'#DatePicker_hora_inicio\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n$(\'#DatePicker_hora_fin\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n\n/* $(document).ready(() => {\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre,\' | \',precio_venta)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            // PCO_CondicionFiltrado: \"tipo_producto=\"+$(\'#tipo_venta\').val()+filtradoProductos,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n});*/','B'),(1394,'core_formulario[8].javascript','2025-02-14 16:30:00','rafael',397,14358,'const { \n    id_cliente, id_producto, cantidad, numero_documento, telefono, nombre_completo, hora_inicio, hora_fin, guaje,\n    id, idClienteDB, total_fake, dinero_entregado, devuelta, tipo_venta, id_mecanico, placa, tipo_pago, precio, estado\n} = document.datos;\n\nconst lavado = 1;\nconst producto = 2;\nconst servicio = 3;\n\nconst formatter = (n, d = 2) => new Intl.NumberFormat(\'es-MX\').format(n);\n\nfunction isMobileDevice() {\n  return /Mobi|Android|iPhone|iPad|iPod|Windows Phone/i.test(navigator.userAgent);\n}\n\nfunction actualizarInforme() {\n    $(\'#informeCompra\').html(PCO_ObtenerContenidoAjax(0, \'index.php\',\n        \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=inf:11:0&id=\' + id.value)\n    );\n}\n\nfunction cargarDatosFE(resp) {\n    const { total, iva } = resp;\n    total_fake.value = formatter(total).replace(\'$\',\'\');\n    // iva_fake.value = formatter(iva).replace(\'$\',\'\');\n    /* if(!id.value && resp.id)\n        id.value = resp.id; */\n    actualizarInforme();\n}\n\nfunction calcularTiempo() {\n    const horaInicio = $(\'#hora_inicio\').val();\n    const horaFin = $(\'#hora_fin\').val();\n    if (!horaInicio || !horaFin) return;\n    const hiMom = moment(horaInicio, \"hh:mm:ss\");\n    const hfMom = moment(horaFin, \"hh:mm:ss\");\n    const duration = moment.duration(hfMom.diff(hiMom));\n    const minutes = duration.asHours() || 0;\n    $(\'#cantidad\').val((minutes).toFixed(2));\n}\n\nfunction consultarTotalVenta() {\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_consultarTotalVenta\' +\n            \'&id=\' + id.value\n        )\n    );\n    if(resp.success) {\n        cargarDatosFE(resp);\n    }\n    else {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n    }    \n}\n\nfunction FrmAutoRun()\n    {\n        document.title = \"Realizar venta\";\n        $(\'#PCOContenedor_id_mecanico\').hide();\n        $(\'#PCOContenedor_hora_inicio\').hide();\n        $(\'#PCOContenedor_hora_fin\').hide();\n        $(\'#PCOContenedor_guaje\').hide();\n        $(\'#PCOContenedor_factura_pagada\').hide();\n        $(\'#PCOContenedor_firma\').hide();\n\n        if($(\'#id\').val()) {\n            //$(\'#add_product\').hide();\n            $(\'#PCOContenedor_clientesSubForm\').hide();\n            // $(\'#id_cliente\').val(idClienteDB.value);\n            // PCOJS_ActualizarComboBox(\'id_cliente\');\n           actualizarInforme();\n          if($(\'#id_cliente\').val() == 1) {\n                $(\'#PCOContenedor_placa\').show();\n            } else {\n                $(\'#PCOContenedor_placa\').hide();\n            }\n            onChangeTipoProducto();\n            consultarTotalVenta();\n        }\n        else {\n            $(\'#finalizar_venta\').hide();\n            $(\'#btn_update\').hide();\n            $(\'#PCOContenedor_placa\').hide();\n        }\n        \n        if (isMobileDevice()) {\n          $(\'#CANVAS_firma\').width(250);\n          $(\'#CANVAS_firma\').height(150);\n        }\n    }\n\n function onchangeCliente(){\n    $(\'#PCOContenedor_placa\').show();\n    if($(\'#id_cliente\').val() == 1) {\n        $(\'#PCOContenedor_placa\').show();\n    } \n} \n\nfunction agregarProducto() {\n    if(validarDatosCompra()) {\n        if(!id.value) {\n            document.datos.PCO_Accion.value = \'VENTA_agregarProductoCrearOC\';\n            document.datos.Precarga_EstilosBS.value = 1;\n            document.datos.Presentar_FullScreen.value = 0;\n            document.datos.target = \'_self\';\n        	document.datos.submit();\n        }\n        else {\n            const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n                \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_agregarProducto\' +\n                    \'&id=\' + id.value + \n                    \'&id_cliente=\' + id_cliente.value +\n                    \'&id_producto=\' + id_producto.value +\n                    \'&cantidad=\' + cantidad.value +\n                    \'&precioVenta=\' + precio.value +\n                    \'&hora_inicio=\' + hora_inicio.value +\n                    \'&hora_fin=\' + hora_fin.value +\n                    \'&guaje=\' + guaje.value\n                )\n            );\n            if(resp.success) {\n                cargarDatosFE(resp);\n                $(\'#finalizar_venta\').show();\n                $(\'#id_producto\').val(\'\');\n                PCOJS_ActualizarComboBox(\'id_producto\');\n                $(\'#precio\').val(\'\');\n                $(\'#cantidad\').val(\'1\');\n            }\n            else {\n                PCOJS_MostrarMensaje(\"Aviso del sistema\", resp.msg);\n            }\n        }\n    }\n}\n\nfunction mostrarMensajePopUp(TituloPopUp, Mensaje) {\n    $(\'#modalMensajeTitulo\').html(TituloPopUp);\n	$(\'#modalMensajeCuerpo\').html(Mensaje);\n\n    //Retira cualquier clase preexistente o remanente de cualquier personalizacion previa y agrega las clases base\n    $(\"#modalMensaje\").removeClass();\n    $( \"#modalMensaje\" ).addClass( \"modal\" );\n    $( \"#modalMensaje\" ).addClass( \"fade\" );\n    $( \"#modalMensaje\" ).addClass( \"oculto_impresion\" );\n\n    //Agrega las clases personalizadas por el usuario\n    /* if (ClasesAdicionales!=\"\")\n        $( \"#modalMensaje\" ).addClass( ClasesAdicionales ); */\n\n	// Se muestra el cuadro modal\n	$(\'#modalMensaje\').modal(\'show\');\n\n	//Hacer que la ventana este siempre por encima\n	$(\"#modalMensaje\").css(\"z-index\", \"1500\");\n}\n\nfunction editProduct() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent,cant,prec] = product.split(\'|\');\n    /* PCOJS_MostrarMensajeCargando(\"Editar producto\", PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    )); */\n    mostrarMensajePopUp(\'Editar producto\', PCO_ObtenerContenidoAjax(0, \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PCO_CargarObjeto&PCO_Objeto=frm:7:1\'+\n        \'&id2=\' + idVent +\n        \'&cantidad2=\' + cant +\n        \'&precio2=\' + prec\n    ));\n\n}\n\nfunction finalizarEdicionProducto() {\n    $(\'#modalMensaje\').modal(\'hide\');\n	$(\'#modalMensaje\').hide();\n    consultarTotalVenta();\n    actualizarInforme();\n}\n\nfunction actualizarProducto2()\n    {\n        if(!$(\'#id2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Venta\", \"No estas trabajando sobre una venta\");\n            return;\n        }\n        if(!$(\'#cantidad2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Cantidad\", \"La cantidad es obligatoria\");\n            return;\n        }\n        if(!$(\'#precio2\').val()) {\n            PCOJS_MostrarMensaje(\"Alerta Precio\", \"El precio es obligatorio\");\n            return;\n        }\n        const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n            \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_actualizarProductoVenta\' +\n                \'&id=\' + $(\'#id2\').val() + \n                \'&id_producto=\' + $(\'#id_producto2\').val()  +\n                \'&cantidad=\' + $(\'#cantidad2\').val() +\n                \'&precio=\' + $(\'#precio2\').val()\n            )\n        );\n        finalizarEdicionProducto();\n    }\n\nfunction finalizarCompra() {\n    /*if(tipo_pago.value != \'Credito\' && dinero_entregado.value < total_fake.value) {\n        PCOJS_MostrarMensaje(\"Editar producto\", \"El valor a pagar es menor al total!\");\n        return;\n    }*/\n    actualizar_CANVAS_firma();\n    estado.value = 1;\n    //Actualiza\n        /*document.datos.PCO_Accion.value = \'PCO_ActualizarDatosFormulario\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n    //Abre la venta para imprimirla\n        /*document.datos.PCO_Accion.value = \'VENTA_imprimirFactura\';\n        document.datos.id_registro_datos.value = id.value;\n        document.datos.Precarga_EstilosBS.value = 0;\n        document.datos.Presentar_FullScreen.value = 1;\n    	document.datos.target = \'_blank\';\n    	document.datos.submit();*/\n\n    document.datos.PCO_Accion.value=\'PCO_ActualizarDatosFormulario\';\n    PCOJS_ValidarCamposYProcesarFormulario(\'datos\');\n}\n\nfunction eliminar_producto() {\n    const product = document.FRMBASEINFORME.PCO_Valor.value;\n    const [idVent] = product.split(\'|\');\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=VENTA_eliminarProducto\' +\n            \'&id_venta=\' + id.value +\n            \'&id_venta_detalle=\' + idVent\n        )\n    );\n    cargarDatosFE(resp);\n}\n\nfunction validarDatosCompra() {\n    /* if(!id_cliente.value && !nombre_completo.value && !numero_documento.value && !telefono.value && id_cliente.value != 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    } */\n    if(!id_cliente.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar o ingresar un cliente!\");\n        return false;\n    }\n    if(!cantidad.value || isNaN(cantidad.value) || cantidad.value < 1) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una cantidad válida!\");\n        return false;\n    }\n    if(!id_producto.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un producto\");\n        return false;\n    }\n    if(id_cliente.value == 1 && !placa.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes ingresar una placa\");\n        return false;\n    }\n    if(tipo_venta.value == servicio && !id_mecanico.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un mecánico\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && (!hora_inicio.value || !hora_fin.value)) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar una hora inicio y hora fin\");\n        return false;\n    }\n    if(tipo_venta.value == lavado && !guaje.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes seleccionar un guaje\");\n        return false;\n    }\n    if(!precio.value) {\n        PCOJS_MostrarMensaje(\"Aviso del sistema\", \"Debes agregar un precio al producto\");\n        return false;\n    }\n    return true;\n}\n\nconst convertToInt = (n) => parseInt(n.replace(/,/g, \"\"));\n\nfunction calcularDevuelta() {\n    devuelta.value = \'\';\n    if(dinero_entregado.value && total_fake.value) {\n        dinero_entregado.value = dinero_entregado.value.replace(/\\D/g, \"\")\n            .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n        const diff = convertToInt(dinero_entregado.value) - convertToInt(total_fake.value);\n        //console.log({diff});\n        devuelta.value = formatter(diff).replace(\'$\', \'\');\n    }\n}\n/*\n        $(event.target).val(function (index, value ) {\n            return value.replace(/\\D/g, \"\")\n                        .replace(/([0-9])([0-9]{2})$/, \'$1.$2\')\n                        .replace(/\\B(?=(\\d{3})+(?!\\d)\\.?)/g, \",\");\n*/\n\nconst origenListaOpciones = ({ PCO_TablaConsulta, PCO_ListaCamposRetorno, PCO_ListaCamposBusqueda, PCO_CondicionFiltrado }) => ({\n      values: \"a, b, c\",\n      ajax: {\n        url: \"index.php\",\n        type: \"POST\",\n        dataType: \"json\",\n        data: {\n          q: \"{{{q}}}\",\n          PCO_Accion: \"PCO_ObtenerOpcionesAjaxSelect\",\n          Presentar_FullScreen: \"1\",\n          PCO_TablaConsulta,\n          PCO_ListaCamposRetorno,\n          PCO_ListaCamposBusqueda,\n          PCO_CondicionFiltrado\n        }\n      },\n      minLength: 3,\n      locale: {\n        emptyTitle: \"Seleccione y digite para buscar\",\n        statusInitialized: \"Empiece a digitar para recuperar registros\",\n        statusSearching: \"Cargando...\",\n        currentlySelected: \"Actualmente seleccionado(s):\",\n        errorText: \"No se pueden recuperar registros\",\n        statusTooShort: \"Ingrese al menos tres caracteres\",\n        statusNoResults: \"No se encuentran resultados\",\n        searchPlaceholder: \"Buscar...\"\n      },\n      log: 0,\n      preprocessData: (data) => data.length ? data.map(({ T: text, V: value, S: subtext, I: icon }) => ({\n        text,\n        value,\n        data: {\n          subtext,\n          icon,\n        }\n        })) : []\n});\n\nfunction onChangeTipoProducto() {\n    $(\'#PCOContenedor_id_mecanico\').hide();\n    if(tipo_venta.value == servicio) $(\'#PCOContenedor_id_mecanico\').show();\n\n    $(\'#PCOContenedor_hora_inicio\').hide();\n    $(\'#PCOContenedor_hora_fin\').hide();\n    $(\'#PCOContenedor_guaje\').hide();\n    if(tipo_venta.value == lavado) {\n        $(\'#PCOContenedor_hora_fin\').show();\n        $(\'#PCOContenedor_hora_inicio\').show();\n        $(\'#PCOContenedor_guaje\').show();\n    }\n\n    // const filtradoProductos = tipo_venta.value == 2 ? \" AND inventario>0\" : \"\";\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            PCO_CondicionFiltrado: \"AND tipo_producto=\"+tipo_venta.value,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n}\n\nfunction getProduct() {\n    if(!id_producto.value || tipo_venta.value != lavado) return;\n    const resp = JSON.parse(PCO_ObtenerContenidoAjax(0,\n        \'index.php\', \'Presentar_FullScreen=1&Precarga_EstilosBS=0&PCO_Accion=PRODUCTOS_getProductById\' +\n            \'&id=\' + $(\'#id_producto\').val()\n        )\n    );\n    $(\'#precio\').val(resp.precio_venta || \"\")\n}\n\nfunction onchangeTipoPago() {\n    $(\'#PCOContenedor_factura_pagada\').hide();\n    $(\'#PCOContenedor_firma\').hide();\n    if(tipo_pago.value == \"Credito\") {\n        $(\'#PCOContenedor_factura_pagada\').show();\n        $(\'#PCOContenedor_firma\').show();\n    }\n}\n\n$(\'#DatePicker_hora_inicio\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n$(\'#DatePicker_hora_fin\').on(\'dp.change\', function(e){ calcularTiempo(); });\n\n\n/* $(document).ready(() => {\n    $(\"#id_producto\").selectpicker().ajaxSelectPicker(\n        origenListaOpciones({ \n            PCO_TablaConsulta: \"app_productos\",\n            PCO_ListaCamposRetorno: \"id,CONCAT(codigo,\' | \',nombre,\' | \',precio_venta)\",\n            PCO_ListaCamposBusqueda: \"codigo,nombre\",\n            // PCO_CondicionFiltrado: \"tipo_producto=\"+$(\'#tipo_venta\').val()+filtradoProductos,\n        }));\n    $(\"#id_producto\").trigger(\"change\");\n});*/','B'),(1395,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:39:00','rafael',426,10601,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n        <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1396,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:40:00','rafael',426,10601,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><span><?php echo  $novedad[\"fecha\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"tipo_novedad\"] ?></span></td>\n               <td><span><?php echo  $novedad[\"valor_novedad\"] ?></span></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1397,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:41:00','rafael',426,10563,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1398,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:42:00','rafael',424,10530,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1399,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:43:00','rafael',424,10531,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades1: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1400,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:43:00','rafael',424,10531,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1401,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:43:00','rafael',426,10572,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n                  </tbody>\n      </table>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1402,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:44:00','rafael',426,10572,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n                  </tbody>\n      </table>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1403,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:45:00','rafael',426,10641,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n                  </tbody>\n      </table>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] == \"debitar\" ? -$novedad[\"valor_novedad\"] : $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1404,'mod/app_ventas/liquidacion_mecanicos.php','2025-02-14 16:45:00','rafael',426,10641,'<?php\n\n @session_start();\n\nif(!isset($_SESSION[\'PCOSESS_SesionAbierta\'])) {\n	echo \'<head><title>Error</title><style type=\"text/css\"> body { background-color: #000000; color: #7f7f7f; font-family: sans-serif,helvetica; } </style></head><body><table width=\"100%\" height=\"100%\" border=0><tr><td align=center>&#9827; Acceso no autorizado !</td></tr></table></body>\';\n	die();\n}\n\n$otrosCostos = $liq[\'otrosCostos\'];\n$sub_total = $liq[\'subTotal\'];\n$total = $liq[\'total\'];\n// $codigobarra = $factura[\"codigo_gs1\"]; // \"7709998678439\";\n// $BarcodeParent = \"(415)$codigobarra(8020)\" . $factura[\"id\"] . \"(3900)$totalBr(96)$fechaSinRecargoBr\";\n\n$descargar = 0;\n/* if ($PCO_Accion == \"FACTURAS_descargarFactura\")\n    $descargar = 1; */\n\n?>\n\n<html>\n\n<head>\n   <meta charset=\"utf-8\">\n   <title>Factura</title>\n   <style>\n      * {\n         border: 0;\n         box-sizing: content-box;\n         color: inherit;\n         font-family: Verdana;\n         font-size: inherit;\n         font-style: inherit;\n         font-weight: inherit;\n         line-height: inherit;\n         list-style: none;\n         margin: 0;\n         padding: 0;\n         text-decoration: none;\n         vertical-align: top;\n      }\n\n      /* heading */\n      h1 {\n         font: bold 100% sans-serif;\n         letter-spacing: 0.5em;\n         text-align: center;\n         text-transform: uppercase;\n      }\n\n      /* table */\n      table {\n         font-size: 75%;\n         table-layout: fixed;\n         width: 100%;\n         break-after: auto;\n         border-collapse: separate;\n         border-spacing: 3px;\n      }\n\n      th,\n      td {\n         border-width: 1px;\n         padding: 0.5em;\n         position: relative;\n         text-align: center;\n      }\n\n      th,\n      td {\n         border-radius: 0.25em;\n         border-style: solid;\n      }\n\n      th {\n         background: #1f60a0;\n         color: #fff;\n         border-color: #BBB;\n      }\n\n      td {\n         border-color: #DDD;\n      }\n\n      /* page */\n      html {\n         font: 13px/1 \"Open Sans\", sans-serif;\n         overflow: auto;\n         padding: 0.5in;\n      }\n\n      html {\n         background: #999;\n         cursor: default;\n      }\n\n      body {\n         box-sizing: border-box;\n         min-height: 11in;\n         margin: 0 auto;\n         overflow: hidden;\n         padding: 0.5in;\n         width: 8.5in;\n      }\n\n      body {\n         background: #FFF;\n         border-radius: 1px;\n         box-shadow: 0 0 1in -0.25in rgba(0, 0, 0, 0.5);\n      }\n\n      /* header */\n\n      header {\n         margin: 0 0 3em;\n      }\n\n      header:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      header h1 {\n         background: #000;\n         border-radius: 0.25em;\n         color: #FFF;\n         margin: 0 0 1em;\n         padding: 0.5em 0;\n      }\n\n      header address {\n         float: left;\n         font-size: 75%;\n         font-style: normal;\n         line-height: 1.25;\n         margin: 0 1em 1em 0;\n      }\n\n      header address p {\n         margin: 0 0 0.25em;\n      }\n\n      header span,\n      header img {\n         display: block;\n         float: right;\n      }\n\n      header span {\n         margin: 0 0 1em 1em;\n         max-height: 25%;\n         max-width: 60%;\n         position: relative;\n      }\n\n      header img {\n         max-height: 100%;\n         max-width: 100%;\n      }\n\n      header input {\n         cursor: pointer;\n         -ms-filter: \"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)\";\n         height: 100%;\n         left: 0;\n         opacity: 0;\n         position: absolute;\n         top: 0;\n         width: 100%;\n      }\n\n      /* article */\n\n      article,\n      article address,\n      table.meta,\n\n      article:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      article h1 {\n         clip: rect(0 0 0 0);\n         position: absolute;\n      }\n\n      article address {\n         float: left;\n         font-size: 125%;\n      }\n\n      /* table meta & balance */\n\n      table.meta,\n      table.balance {\n         float: right;\n         width: 36%;\n      }\n\n      table.meta:after,\n      table.balance:after {\n         clear: both;\n         content: \"\";\n         display: table;\n      }\n\n      /* table meta */\n\n      table.meta th {\n         width: 40%;\n      }\n\n      table.meta td {\n         width: 60%;\n      }\n\n      table.inventory {\n         margin: 0 0 1.3em;\n      }\n      /* table items */\n\n      table.inventory {\n         clear: both;\n         width: 100%;\n      }\n\n      table.inventory th {\n         font-weight: bold;\n         text-align: center;\n      }\n\n      /* table balance */\n\n      table.balance th {\n         width: 60%;\n         text-align: center;\n      }\n\n      table.balance td {\n         width: 60%;\n         text-align: center;\n      }\n\n      /* aside */\n\n      aside h1 {\n         border: none;\n         border-width: 0 0 1px;\n         margin: 0 0 1em;\n      }\n\n      aside h1 {\n         border-color: #999;\n         border-bottom-style: solid;\n      }\n\n      /* javascript */\n\n      @media print {\n         * {\n            -webkit-print-color-adjust: exact;\n         }\n\n         html {\n            background: none;\n            padding: 0;\n         }\n\n         body {\n            box-shadow: none;\n            margin: 0;\n         }\n\n         span:empty {\n            display: none;\n         }\n      }\n\n      @page {\n         margin: 0;\n         page: letter;\n      }\n   </style>\n    <!--<link rel=\"stylesheet\" href=\"inc/pdfLib/all.min.css\">-->\n    <!--<script type=\"text/javascript\" src=\"inc/pdfLib/html2pdf.bundle.min.js\"></script>-->\n    <!--<script type=\"text/javascript\" src=\"inc/bwip/bwip-js-min.js\"></script>-->\n    \n            <!--<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css\">-->\n            <!--<script src=\"https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js\"\n              integrity=\"sha512-GsLlZN/3F2ErC5ifS5QtgpiJtWd43JWSuIgh7mbzZ8zBps+dvLusV+eNQATqgA/HdeKFVgA5v3S/cIrLF7QnIg==\"\n              crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"></script>-->\n</head>\n<body id=\"Invoices\">\n   <article>\n      <table class=\"meta\">\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha inicio</span></th>\n            <td><span><?php echo $liq[\"fecha_inicio\"] ?></span></td>\n         </tr>\n        <tr>\n            <th style=\"width: 120px !important;\"><span>Fecha fin</span></th>\n            <td><span><?php echo $liq[\"fecha_fin\"] ?></span></td>\n         </tr>\n      </table>\n      <address>\n         <!--<p style=\"color:#14406b; font-size: 18px; font-weight: bold;\">AUTONORTE</p>\n         <p style=\"font-size: 12px;\">NIT: 811018300-6</p>\n         <p style=\"font-size: 12px;\">CLL 21 # 8-78 San Jerónimo, Ant</p> -->\n         <BR>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Nombre: </span><?php echo $liq[\"nombre_completo\"] ?><br>\n            <span style=\"font-weight: bold;\">Dirección: </span><?php echo  $liq[\"direccion\"] ?><br>\n         </p>\n      </address>\n\n      <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Valor venta</span></th>\n               <th><span>Valor abono</span></th>\n               <th><span>Valor débito</span></th>\n               <th><span>Seguridad social</span></th>\n            </tr>\n         </thead>\n         <tbody>\n            <tr>\n               <td><span><?php echo $liq[\"valor_venta\"] ?></span></td>\n               <td><span><?php echo  $liq[\"valor_novedad_abonar\"] ?></span></td>\n               <td><span><?php echo $liq[\"valor_novedad_debitar\"] ?></span></td>\n               <td><span><?php echo  $liq[\"seguridad_social\"] ?></span></td>\n            </tr>\n         </tbody>\n      </table>\n      <?php \n        if (count($ventas)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Ventas: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th width=\"6%\"><span>Factura</span></th>\n               <th width=\"17%\"><span>Fecha</span></th>\n               <th width=\"34%\"><span>Cliente</span></th>\n               <th width=\"35%\"><span>Producto</span></th>\n               <th width=\"8%\"><span>Total Mecánico</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($ventas as $venta) {\n             ?>\n            <tr>\n               <td><?php echo $venta[\"id\"] ?></td>\n               <td><?php echo $venta[\"fecha\"] ?></td>\n               <td><?php echo $venta[\"nombre_completo\"] ?></td>\n               <td><?php echo $venta[\"nombre\"] ?></td>\n               <td style=\"align: \'right\' !important;\"><?php echo $venta[\"total_mecanico\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n                  </tbody>\n      </table>\n         <br>\n        <?php \n        if (count($novedades)) {\n    ?>\n    <br>\n         <p style=\"font-size: 12px;\">\n            <span style=\"font-weight: bold;\">Novedades: </span>\n         </p>\n        <table class=\"inventory\">\n         <thead>\n            <tr>\n               <th><span>Fecha</span></th>\n               <th><span>Tipo novedad</span></th>\n               <th><span>Valor novedad</span></th>\n            </tr>\n         </thead>\n         <tbody>\n         <?php\n         foreach ($novedades as $novedad) {\n             ?>\n            <tr>\n               <td><?php echo  $novedad[\"fecha\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] ?></td>\n               <td><?php echo  $novedad[\"tipo_novedad\"] == \"Debitar\" ? -$novedad[\"valor_novedad\"] : $novedad[\"valor_novedad\"] ?></td>\n            </tr>\n        <?php\n         }\n      }\n         ?>\n         </tbody>\n      </table>\n\n      <table class=\"balance\" style=\"font-size: 11px;\">\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>SUBTOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $sub_total ?></span></th>\n         </tr>\n         <tr>\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL COBROS</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $otrosCostos ?></span></th>\n         </tr>\n         <tr style=\"color: #fff; font-size: 12px;\">\n            <td style=\"background-color: #1f60a0; font-weight: bold;\"><span>TOTAL</span></td>\n            <th style=\"background-color: #14406b;\"><span><?php echo $total ?></span></th>\n         </tr>\n       \n            \n        </tr>\n         </tr>\n      </table>\n      </div>\n   </article>\n\n</body>\n</html>','A'),(1405,'mod/app_ventas/index.php','2025-02-14 16:47:00','rafael',316,14678,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo, CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1406,'mod/app_ventas/index.php','2025-02-14 16:47:00','rafael',316,14737,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo, CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1407,'mod/app_ventas/index.php','2025-02-14 16:48:00','rafael',316,14796,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo, CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1408,'mod/app_ventas/index.php','2025-02-14 16:49:00','rafael',316,14796,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo, CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1409,'mod/app_ventas/index.php','2025-02-14 16:49:00','rafael',316,14796,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo, CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),(1410,'mod/app_ventas/index.php','2025-02-14 16:50:00','rafael',316,14796,'<?php\n\nfunction formatNumber($n) {\n    return \"$\".number_format($n, 2, \",\", \".\");\n}\n\nfunction calcularTotalVenta($id, $returnArr = \"\") {\n    $venta = PCO_EjecutarSQL(\"\n        SELECT SUM(precio * cantidad) as total, SUM(precio * iva/100) iva\n        FROM app_ventas_detalle\n        WHERE id_venta = \'$id\' GROUP BY id_venta\n    \")->fetch();\n    $ventaMecanico = PCO_EjecutarSQL(\"\n        SELECT TRUNCATE(SUM(vd.precio * vd.cantidad * p.porcentaje_mecanico/100), 2)\n        FROM app_ventas_detalle vd, app_ventas v, app_productos p\n        WHERE vd.id_venta=v.id AND vd.id_producto=p.id AND  vd.id_venta = \'$id\' AND v.id_mecanico <> 0 GROUP BY vd.id_venta\n    \")->fetchColumn();\n    $total = $venta[\"total\"] ? $venta[\"total\"] : 0;\n    $iva = $venta[\"iva\"] ? $venta[\"iva\"] : 0;\n    PCO_EjecutarSQLUnaria(\"UPDATE app_ventas SET total = $total, iva = $iva, total_mecanico=\'$ventaMecanico\' WHERE id = $id \");\n    if($returnArr)\n        return $venta;\n    return \'\"total\": \' . $total . \', \"iva\": \' . $iva;\n}\n\nif($PCO_Accion == \"VENTA_ingresarRealizarVenta\") {\n    $ventaAbierta = PCO_EjecutarSQL(\"\n        SELECT id, id_cliente, total, iva, placa\n        FROM app_ventas\n        WHERE id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $id_venta = $ventaAbierta[\"id\"] || \"\";\n    if($id_venta) {\n        $total = number_format($ventaAbierta[\"total\"], 2);\n        $iva = number_format($ventaAbierta[\"iva\"], 2);\n        $id_cliente = $ventaAbierta[\"id_cliente\"];\n    }\n\n    PCO_CargarFormulario(8, 1, \"id\", $id_venta);\n}\n\nif($PCO_Accion == \"VENTA_agregarProductoCrearOC\") {\n        //crear cliente en caso de que no llegue id_cliente\n        if(!$id_cliente) {\n            PCO_EjecutarSQLUnaria(\"INSERT INTO app_clientes (nombre_completo, numero_documento, telefono) VALUES (?,?,?) \",\n                \"$nombre_completo$_SeparadorCampos_$numero_documento$_SeparadorCampos_$telefono\"\n            );\n            // $id_cliente = PCO_ObtenerUltimoIDInsertado();\n            $id_cliente = PCO_EjecutarSQL(\"\n                SELECT id\n                FROM app_clientes\n                WHERE numero_documento=\'$numero_documento\' AND telefono=\'$telefono\' AND \'$nombre_completo\'\n            \")->fetchColumn();\n        }\n        $todayMysql = date(\"Y-m-d H:i:s\");\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas (id_cliente, usuario, fecha, placa, id_mecanico, tipo_venta) VALUES (?,?,?,?,?,?) \", \"$id_cliente$_SeparadorCampos_$PCOSESS_LoginUsuario$_SeparadorCampos_$todayMysql$_SeparadorCampos_$placa$_SeparadorCampos_$id_mecanico$_SeparadorCampos_$tipo_venta\");\n        $id = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_ventas\n            WHERE fecha=\'$todayMysql\' AND usuario=\'$PCOSESS_LoginUsuario\' AND id_cliente = \'$id_cliente\'\n        \")->fetchColumn();\n        // $id = PCO_ObtenerUltimoIDInsertado();\n\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva, inventario\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precio$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos_$hora_inicio$_SeparadorCampos_$hora_fin$_SeparadorCampos_$guaje\");\n        calcularTotalVenta($id);\n        \n        /* $total = number_format($result[\"total\"], 2);\n        $iva = number_format($result[\"iva\"], 2); */\n\n        echo \'<script type=\"text/javascript\">\n        	document.FRMBASEINFORME.PCO_Accion.value=\"PCO_CargarObjeto\";\n        	document.FRMBASEINFORME.PCO_Objeto.value=\"frm:8:1:id:\'.$id.\'\";\n        	document.FRMBASEINFORME.Precarga_EstilosBS.value=\"1\";\n        	document.FRMBASEINFORME.Presentar_FullScreen.value=\"0\";\n        	document.FRMBASEINFORME.target=\"_self\";\n        	document.FRMBASEINFORME.submit();\n    	 </script>\';\n    }\n}\n\nif($PCO_Accion == \"VENTA_agregarProducto\") {\n    $producto = PCO_EjecutarSQL(\"\n        SELECT id, precio_venta, iva\n        FROM app_productos\n        WHERE id = \'$id_producto\'\n    \")->fetch();\n    if($producto[\"id\"]) {\n        $existe = PCO_EjecutarSQL(\"\n            SELECT count(id)\n            FROM app_ventas_detalle\n            WHERE id_venta = $id AND id_producto = \'$id_producto\'\n        \")->fetchColumn();\n        if($existe > 0) {\n            print_r(\'{\"success\": false, \"msg\": \"El producto ya se ha ingresado\"}\');\n            die();\n        }\n        /* if($producto[\"inventario\"] < $cantidad) {\n            print_r(\'{\"success\": false, \"msg\": \"La cantidad digitada supera la del invetario\"}\');\n            die();\n        } */\n        // $inventarioNew = $producto[\"inventario\"] - $cantidad;\n        // PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"INSERT INTO app_ventas_detalle (id_venta, id_producto, cantidad, precio, iva, hora_inicio, hora_fin, guaje) VALUES (?,?,?,?,?,?,?,?) \", \n            \"$id$_SeparadorCampos_$id_producto$_SeparadorCampos_$cantidad$_SeparadorCampos_$precioVenta$_SeparadorCampos_\" . $producto[\"iva\"].\"$_SeparadorCampos$hora_inicio$_SeparadorCampos$hora_fin$_SeparadorCampos$guaje\");\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se ha encontrado el producto seleccionado\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_consultarTotalVenta\") {\n    if($id) {\n        $result = calcularTotalVenta($id);\n        print_r(\'{\"success\": true, \"id\": \' . $id . \', \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se encontro la venta\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_eliminarProducto\") {\n\n    if($id_venta_detalle && $id_venta) {\n        $producto = PCO_EjecutarSQL(\"\n            SELECT p.inventario, vd.cantidad, p.id\n            FROM app_ventas_detalle vd, app_productos p\n            WHERE vd.id_producto = p.id AND vd.id = \'$id_venta_detalle\'\n        \")->fetch();\n        //Restablecemos el inventario\n        $inventarioNew = $producto[\"inventario\"] + $producto[\"cantidad\"];\n        PCO_EjecutarSQLUnaria(\"UPDATE app_productos SET inventario = $inventarioNew WHERE id = \" . $producto[\"id\"]);\n        PCO_EjecutarSQLUnaria(\"DELETE FROM app_ventas_detalle WHERE id_venta = $id_venta AND id = $id_venta_detalle\");\n        $result = calcularTotalVenta($id_venta);\n        print_r(\'{\"success\": true, \"msg\": \"Se ha eliminado el producto exitosamente\", \' . $result . \'}\');\n        die();\n    }\n    print_r(\'{\"success\": false, \"msg\": \"No se pudo eliminar el producto\"}\');\n    die();\n}\n\nif($PCO_Accion == \"VENTA_actualizarProductoVenta\") {\n    if($id) {\n        PCO_EjecutarSQLUnaria(\"UPDATE app_ventas_detalle SET cantidad=\'$cantidad\', precio=\'$precio\' WHERE id = \'$id\'\");\n        echo 1;\n        die();\n    }\n    echo 0;\n    die();\n}\n\nif($PCO_Accion == \"VENTA_imprimirFactura\") {\n    if($PCO_Valor)\n        $id = $PCO_Valor;\n    if($id) {\n        include_once \"imprimirFactura.php\";\n    }\n}\n\nif($PCO_Accion == \"VENTA_generarLiquidacionMecanicos\") {\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico <> 0 AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetchAll();\n    foreach ($ventas as $venta) {\n        $valor_novedad = PCO_EjecutarSQL(\"\n            SELECT  \n                SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n                SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n            FROM app_novedades_mecanicos\n            WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\'\n                AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n            GROUP BY id_mecanico\n        \")->fetch();\n\n        PCO_EjecutarSQLUnaria(\"\n            INSERT INTO app_liquidacion_mecanicos_enc (id_mecanico, fecha_inicio, fecha_fin, fecha, valor_venta, valor_novedad_abonar, valor_novedad_debitar, seguridad_social, usuario) VALUES (?,?,?,?,?,?,?,?,?) \",\n            $venta[\"id_mecanico\"].\"$_SeparadorCampos_$fecha_inicio$_SeparadorCampos_$fecha_fin$_SeparadorCampos_$PCO_FechaOperacionGuiones$_SeparadorCampos_\".$venta[\"Total\"].\"$_SeparadorCampos_\".$valor_novedad[\'abonar\'].\"$_SeparadorCampos_\".$valor_novedad[\'debitar\'].\"$_SeparadorCampos_\".$venta[\"seguridad_social\"].\"$_SeparadorCampos_$PCOSESS_LoginUsuario\"\n        );\n        \n        $idLiq = PCO_EjecutarSQL(\"\n            SELECT id\n            FROM app_liquidacion_mecanicos_enc\n            WHERE id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND fecha=\'$PCO_FechaOperacionGuiones\' AND usuario = \'$PCOSESS_LoginUsuario\'\n            ORDER BY id desc LIMIT 1\n        \")->fetchColumn();\n\n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_novedades_mecanicos \n            SET id_liquidacion=\'$idLiq\'\n            WHERE \n                fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n        \n        PCO_EjecutarSQLUnaria(\"\n            UPDATE app_ventas \n            SET id_liquidacion=\'$idLiq\'\n            WHERE app_ventas.fecha >= \'$fecha_inicio 00:00:00\' AND app_ventas.fecha <= \'$fecha_fin 23:59:59\' AND app_ventas.estado = 1 AND id_mecanico=\'\".$venta[\'id_mecanico\'].\"\' AND id_liquidacion=0\n        \");\n    }\n    PCO_CargarFormulario(14);\n}\n\nif($PCO_Accion == \"VENTAS_PreVisualizarLiquidacion\") {\n    $idMecanico = $id_registro_datos;\n\n    $liq[\'fecha_inicio\'] = $fecha_inicio;\n    $liq[\'fecha_fin\'] = $fecha_fin;\n\n    $ventasLiq = PCO_EjecutarSQL(\"\n        SELECT v.id, v.id_mecanico, SUM(v.total_mecanico) as Total, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo, m.seguridad_social\n        FROM app_mecanicos m,app_ventas v\n        WHERE m.id = v.id_mecanico AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.estado = 1 AND id_mecanico = \'$idMecanico\' AND id_liquidacion=0\n        GROUP BY v.id_mecanico\n    \")->fetch();\n    $liq[\'valor_venta\'] = $ventasLiq[\'Total\'];\n    //Mecanico\n    $liq[\'nombre_completo\'] = $ventasLiq[\'nombre_completo\'];\n    $liq[\'cedula\'] = $ventasLiq[\'cedula\'];\n    $liq[\'telefono\'] = $ventasLiq[\'telefono\'];\n    $liq[\'direccion\'] = $ventasLiq[\'direccion\'];\n    $liq[\'correo\'] = $ventasLiq[\'correo\'];\n    $liq[\'seguridad_social\'] = $ventasLiq[\'seguridad_social\'];\n    \n\n    $novedadLiq = PCO_EjecutarSQL(\"\n        SELECT  \n            SUM(case when tipo_novedad=\'Abonar\' then valor_novedad else 0 end) as abonar,\n            SUM(case when tipo_novedad=\'Debitar\' then valor_novedad else 0 end) as debitar\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n        GROUP BY id_mecanico\n    \")->fetch();\n\n    $liq[\'valor_novedad_abonar\'] = $novedadLiq[\'abonar\'] ? $novedadLiq[\'abonar\'] : 0;\n    $liq[\'valor_novedad_debitar\'] = $novedadLiq[\'debitar\'] ? $novedadLiq[\'debitar\'] : 0;\n    \n    $total = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'] - $liq[\'valor_novedad_debitar\'] - $liq[\'seguridad_social\'];\n    $liq[\'total\'] = formatNumber($total);\n    $subTotal = $liq[\'valor_venta\'] + $liq[\'valor_novedad_abonar\'];\n    $liq[\'subTotal\'] = formatNumber($subTotal);\n    $otrosCostos = $liq[\'valor_novedad_debitar\'] + $liq[\'seguridad_social\'];\n    $liq[\'otrosCostos\'] = formatNumber(-$otrosCostos);\n    \n    $liq[\'seguridad_social\'] = formatNumber($liq[\'seguridad_social\']);\n    $liq[\'valor_venta\'] = formatNumber($liq[\'valor_venta\']);\n    $liq[\'valor_novedad_abonar\'] = formatNumber($liq[\'valor_novedad_abonar\']);\n    $liq[\'valor_novedad_debitar\'] = formatNumber($liq[\'valor_novedad_debitar\']);\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo,\n            CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente \n        AND v.fecha >= \'$fecha_inicio 00:00:00\' AND v.fecha <= \'$fecha_fin 23:59:59\' AND v.id_mecanico=\'$idMecanico\' AND v.estado = 1 AND v.id_liquidacion=0\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE fecha >= \'$fecha_inicio\' AND fecha <= \'$fecha_fin\' AND id_mecanico=\'$idMecanico\' AND id_liquidacion=0\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}\n\nif($PCO_Accion == \"VENTAS_verLiquidacion\") {\n    $liq = PCO_EjecutarSQL(\"\n        SELECT l.*, m.nombre_completo, m.cedula, m.telefono, m.direccion, m.correo,\n            CONCAT(\'$\',FORMAT((l.valor_venta + l.valor_novedad_abonar - l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) total,\n            CONCAT(\'$\',FORMAT(l.valor_venta + l.valor_novedad_abonar,2,\'de_DE\')) subTotal,\n            CONCAT(\'$\',FORMAT((-l.valor_novedad_debitar - l.seguridad_social),2,\'de_DE\')) otrosCostos\n        FROM app_liquidacion_mecanicos_enc l,app_mecanicos m \n        WHERE l.id_mecanico = m.id AND l.id=\'$PCO_Valor\'\n    \")->fetch();\n\n    $ventas = PCO_EjecutarSQL(\"\n        SELECT v.*, p.nombre, c.nombre_completo, CONCAT(\'$\',FORMAT(v.total_mecanico,0,\'de_DE\')) total_mecanico\n        FROM app_ventas v, app_ventas_detalle vd, app_productos p, app_clientes c\n        WHERE v.id=vd.id_venta AND p.id=vd.id_producto AND c.id=v.id_cliente AND v.id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n\n    $novedades = PCO_EjecutarSQL(\"\n        SELECT *, CONCAT(\'$\',FORMAT(valor_novedad,0,\'de_DE\')) valor_novedad\n        FROM app_novedades_mecanicos\n        WHERE id_liquidacion=\".$liq[\'id\'].\"\n    \")->fetchAll();\n    \n    include \'liquidacion_mecanicos.php\';\n}','A'),