Ejemplo n.º 1
0
     $serial = $obj_modelo->GeneraSerialTicket();
 }
 if ($result = $obj_modelo->GetDatosTicketTransaccional()) {
     $total_ticket = 0;
     while ($row = $obj_conexion->GetArrayInfo($result)) {
         // acumula y suma el total a la variable
         $total_ticket += $row['monto'];
     }
 }
 // Obtenemos los datos de la taquilla
 $fecha_hora = date('Y-m-d H:i:s');
 $id_usuario = $_SESSION['id_usuario'];
 $sql = "INSERT INTO `detalle_ticket_diario` (`id_ticket_diario`, `numero` , `id_sorteo` , `fecha_sorteo`, `id_zodiacal` , `id_tipo_jugada` , `monto`,`monto_restante`,`monto_faltante`) VALUES  ";
 $sw1 = 0;
 if ($obj_modelo->GuardarTicket($id_ticket, $serial, $fecha_hora, $taquilla, $total_ticket, $id_usuario)) {
     if ($result2 = $obj_modelo->GetDatosAllTicketTransaccional()) {
         while ($row = $obj_conexion->GetArrayInfo($result2)) {
             // Guarda los datos en detalle Ticket
             $fecha_sorteo = date('Y-m-d');
             $sql .= "('" . $id_ticket . "', '" . $row['numero'] . "', '" . $row['id_sorteo'] . "', '" . $fecha_sorteo . "', '" . $row['id_zodiacal'] . "', '" . $row['id_tipo_jugada'] . "', '" . $row['monto'] . "', '" . $row['monto_restante'] . "', '" . $row['monto_faltante'] . "'),";
             $sw1 = 1;
         }
         $sql = trim($sql, ',');
         $sql .= ";";
         if ($sw1 == 1) {
             if ($result = $obj_modelo->GuardarSql($sql)) {
                 $sw1 = 2;
             }
         }
         if ($sw1 == 2) {
             echo "Ok";