<?php
defined('BASEPATH') OR exit('No direct script access allowed');

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, OPTIONS, POST, GET, PUT");
header("Access-Control-Allow-Headers: Content-Type, Content-Length, Accept-Encoding");

date_default_timezone_set('Asia/Kolkata');

class Sync extends CI_Controller {
    public function sync_chair()
	{
	    $chair=json_decode($this->input->post('chair'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_chair($chair,$ShopID);
		echo json_encode($check);
	}
    public function sync_Updatechair()
	{
	    $chair=json_decode($this->input->post('chair'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_Updatechair($chair,$ShopID);
		echo json_encode($check);
	}
    public function sync_getAllStaff()
	{
	    $ShopID=$this->input->get('ShopID');
	    $check=$this->Sync_Model->sync_getAllStaff($ShopID);
		echo json_encode($check);
	}
	public function sync_staff()
	{
	    $staff=json_decode($this->input->post('staff'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_staff($staff,$ShopID);
		echo json_encode($check);
	}
	public function sync_Updatestaff()
	{
	    $staff=json_decode($this->input->post('staff'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_Updatestaff($staff,$ShopID);
		echo json_encode($check);
	}
	public function sync_product()
	{
	    $item=json_decode($this->input->post('item'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_product($item,$ShopID);
		echo json_encode($check);
	} 
	public function sync_updateproduct()
	{
	    $item=json_decode($this->input->post('item'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_updateproduct($item,$ShopID);
		echo json_encode($check);
	} 	
    public function sync_ShopActivity()
	{
	    $data=json_decode($this->input->post('data'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_ShopActivity($data,$ShopID);
		echo json_encode($check);
	} 
    public function sync_Bills()
	{
	    $data=json_decode($this->input->post('data'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_Bills($data,$ShopID);
		echo json_encode($check);
	} 
    public function sync_expenses()
	{
	    $data=json_decode($this->input->post('data'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_expenses($data,$ShopID);
		echo json_encode($check);
	} 	
    public function sync_UpdateBill()
	{
	    $data=json_decode($this->input->post('data'));
	    $ShopID=json_decode($this->input->post('ShopID'));
	    $check=$this->Sync_Model->sync_UpdateBill($data,$ShopID);
		echo json_encode($check);
	} 	
    public function sync_shopDetails()
	{
	    $shops=json_decode($this->input->post('shops'));
	    $check=$this->Sync_Model->sync_shopDetails($shops);
		echo json_encode($check);
	} 	
    public function CheckServer()
	{
		echo "OK";
	} 		
    public function sync_getAllUser()
	{
	    $ShopID=$this->input->get('ShopID');
	    $check=$this->Sync_Model->sync_getAllUser($ShopID);
		echo json_encode($check);
	}	
    public function sync_ibilllogin()
	{
	    $UserName=$this->input->get('UserName');
	    $Password=$this->input->get('Password');
	    $check=$this->Sync_Model->sync_ibilllogin($UserName,$Password);
		echo json_encode($check);
	}	
    public function sync_addibillcustomer()
	{
	    $PersonalID=$this->input->get('PersonalID');
	    $CName=$this->input->get('CName');
	    $Company=$this->input->get('Company');
	    $Mobile=$this->input->get('Mobile');
	    $State=$this->input->get('State');
	    $Dist=$this->input->get('Dist');
	    $Place=$this->input->get('Place');
	    $EntryDate=$this->input->get('EntryDate');
	    $SDate=$this->input->get('SDate');
	    $EDate=$this->input->get('EDate');
	    $Days=$this->input->get('Days');
	    $SerialNo=$this->input->get('SerialNo');
	    $check=$this->Sync_Model->sync_addibillcustomer($PersonalID,$CName,$Company,$Mobile,$State,$Dist,$Place,$EntryDate,$SDate,$EDate,$Days,$SerialNo);
		echo json_encode($check);
	}
    public function sync_getIbillSerialNo()
	{
	    $PersonalID=$this->input->get('PersonalID');
	    $check=$this->Sync_Model->sync_getIbillSerialNo($PersonalID);
		echo json_encode($check);
	}
    public function sync_searchIbillCustomer()
	{
	    $Customer=$this->input->get('Customer');
	    $check=$this->Sync_Model->sync_searchIbillCustomer($Customer);
		echo json_encode($check);
	}
	public function sync_Booking()
	{
	    $data=json_decode($this->input->post('data'));
	    $check=$this->Sync_Model->sync_Booking($data);
		echo json_encode($check);
	} 
    public function sync_allbooking()
	{
	    $ShopID=$this->input->get('ShopID');
	    $check=$this->Sync_Model->sync_allbooking($ShopID);
		echo json_encode($check);
	}	
    public function sync_updatebookingstatus()
	{
	    $UID=$this->input->get('UID');
	    $Status=$this->input->get('Status');
	    $check=$this->Sync_Model->sync_updatebookingstatus($UID,$Status);
		echo json_encode($check);
	}	
	public function online_register()
	{
	    $data=json_decode($this->input->post('data'));
	    $check=$this->Sync_Model->online_register($data);
		echo json_encode($check);
	} 	
	
}
