echo json_encode($history);
 } elseif ($action == 'saveTicket') {
     $result = POS::SetTicket($data);
     echo json_encode($result);
 } elseif ($action == 'searchProducts') {
     if (sizeof($data)) {
         $searchValue = $data['data']['search'];
         $warehouse = $data['data']['warehouse'];
         $ticketstate = $data['data']['ticketstate'];
         $customerId = $data['data']['customer'];
         $result = POS::SearchProduct($searchValue, false, $warehouse, 1, $ticketstate, $customerId);
         echo json_encode($result);
     }
 } elseif ($action == 'countProduct') {
     $warehouseId = $data['data'];
     $stock = POS::countProduct($warehouseId);
     echo json_encode($stock);
 } elseif ($action == 'searchStocks') {
     if (sizeof($data)) {
         $searchValue = $data['data']['search'];
         $mode = $data['data']['mode'];
         $warehouse = $data['data']['warehouse'];
         $ticketstate = 0;
         $customerId = 0;
         $result = POS::searchProduct($searchValue, true, $warehouse, $mode, $ticketstate, $customerId);
         echo json_encode($result);
     }
 } elseif ($action == 'searchByAlmacenes') {
     if (sizeof($data)) {
         $searchValue = $data['data']['search'];
         $mode = $data['data']['mode'];