| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/application/modules/webservice/controllers/ |
Upload File : |
<?php
class Webservice_SupplierPaymentController extends Catabatic_ValidateCustomer {
private $_crmcusttravelplan;
public function init() {
parent::init();
$this->_crmcusttravelplan = new Travel_Model_CRM_CustomerTravelPlan();
}
public function getSupplierBillAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
$SupplierMdl = new Webservice_Model_Supplier();
$modelTBOMdl = new Webservice_Model_TboData();
$currentData = date("Y-m-d H:i:s");
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
try {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
if ($AgencySysId > 0) {
$TPSysId = $request_body_array['TPSysId'] ?? null;
$SupplierSysId = $request_body_array['SupplierSysId'] ?? null;
}
$paymentDetails = $SupplierMdl->getSupplierBill($SupplierSysId, $TPSysId);
$returnResponse = ["status" => true, "billDetails" => $paymentDetails];
} catch (Zend_Exception $e) {
$returnResponse = ["status" => false, "errorMessage" => $e->getMessage()];
}
}
}
}
echo json_encode($returnResponse);
exit;
}
public function getSupplierWalletBalanceAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
$SupplierMdl = new Webservice_Model_Supplier();
$modelTBOMdl = new Webservice_Model_TboData();
$currentData = date("Y-m-d H:i:s");
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
try {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
if ($AgencySysId > 0) {
$TPSysId = $request_body_array['TPSysId'] ?? null;
$SupplierSysId = $request_body_array['SupplierSysId'] ?? null;
$getSupplierDetails = $SupplierMdl->getSupplierDetails($SupplierSysId);
$walletRow = $SupplierMdl->getSupplierWalletDetails($SupplierSysId);
if (!$walletRow) {
$CurrencyType = $getSupplierDetails['CurrencyType'];
$supplierWalletData = [
"SupplierSysId" => $SupplierSysId,
"BalanceAmount" => 0,
"CurrencyType" => $CurrencyType,
"UpdateDate" => $currentData,
"IsMarkForDel" => 0,
"IsActive" => 1
];
$WalletId = $modelTBOMdl->insertData('TB_Supplier_Wallet', $supplierWalletData);
} else {
$WalletId = $walletRow['WalletId'];
}
}
$paymentDetails = $SupplierMdl->getSupplierPayment($SupplierSysId, $TPSysId);
$returnResponse = ["status" => true, "paymentDetails" => $paymentDetails, "walletDetails" => $walletRow, "SupplierDetails" => $getSupplierDetails];
} catch (Zend_Exception $e) {
$returnResponse = ["status" => false, "errorMessage" => $e->getMessage()];
}
}
}
}
echo json_encode($returnResponse);
exit;
}
public function getAgencyBankDetailsAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
$AgencySysNew = $request_body_array['AgencySysId'] ?? null;
if ($AgencySysId == $AgencySysNew) {
$bankDetailsArray = $agencyMdl->getAgencyBankDetails($AgencySysId);
echo json_encode(["status" => true, "data" => $bankDetailsArray]);
exit;
}
}
}
}
echo json_encode($returnResponse);
exit;
}
public function getSupplierPaymentHistoryAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
$SupplierId = $request_body_array['SupplierId'] ?? null;
$TPSysId = $request_body_array['TPSysId'] ?? null;
if ($SupplierId && $TPSysId) {
$SupplierMdl = new Webservice_Model_Supplier();
$bankDetailsArray = $SupplierMdl->getSupplierPaymentHistory($SupplierId, $TPSysId);
echo json_encode(["status" => true, "data" => $bankDetailsArray]);
exit;
}
}
}
}
echo json_encode($returnResponse);
exit;
}
public function getSupplierBankDetailsAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
$SupplierSysId = $request_body_array['SupplierSysId'] ?? null;
if ($AgencySysId > 0 && $SupplierSysId > 0) {
$bankDetailsArray = $agencyMdl->getSupplierBankDetails($AgencySysId, $SupplierSysId);
echo json_encode(["status" => true, "data" => $bankDetailsArray]);
exit;
}
}
}
}
echo json_encode($returnResponse);
exit;
}
public function getPaymentMediaTypeAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$headers = getallheaders();
$returnResponse = ["status" => false];
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if ($apiKey) {
$agencyMdl = new Travel_Model_TblAgency();
//$bankDetailsArray = $agencyMdl->getPaymentMediaType();
$paymentDetails = array(
array("PaymentMediaType" => 1, "Name" => "Credit Card"),
array("PaymentMediaType" => 18, "Name" => "Bank Transfer"),
array("PaymentMediaType" => 4, "Name" => "Cash"),
array("PaymentMediaType" => 17, "Name" => "Remittance"),
array("PaymentMediaType" => 16, "Name" => "UPI"),
array("PaymentMediaType" => 19, "Name" => "Advance/Adjustment")
);
echo json_encode(["status" => true, "data" => $paymentDetails]);
exit;
}
}
echo json_encode($returnResponse);
exit;
}
public function indexAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
$modelTBOMdl = new Webservice_Model_TboData();
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
// try {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
if ($AgencySysId > 0) {
$TPSysId = $request_body_array['TPSysId'] ?? null;
$SupplierSysId = $request_body_array['SupplierSysId'] ?? null;
$Amount = (float) $request_body_array['Amount'] ?? 0;
$OtherCharges = (float) $request_body_array['OtherCharges'] ?? 0; // Extra If any
$discount = (float) $request_body_array['Discount'] ?? 0;
$BankCharges = (float) $request_body_array['BankCharges'] ?? 0;
$InvoiceNo = $request_body_array['InvoiceNo'] ?? 0;
$GSTInput = $request_body_array['GSTInput'] ?? 0;
$PaymentType = $request_body_array['PaymentType'] ?? 'advance';
$CGST = (float) $request_body_array['CGST'] ?? 0;
$SGST = (float) $request_body_array['SGST'] ?? 0;
$IGST = (float) $request_body_array['IGST'] ?? 0;
$BillId = $request_body_array['BillId'] ?? 0;
$Tax = $CGST + $SGST + $IGST;
$GSTNo = $request_body_array['GSTNo'] ?? 0;
$Commission = $request_body_array['Commission'] ?? 0;
$TotalPayableAmount = (float) $request_body_array['TotalPayableAmount'] ?? $Amount;
$FCurrencyType = $request_body_array['FCurrencyType'] ?? null;
$CurrencyType = $TCurrencyType = $request_body_array['TCurrencyType'] ?? null;
$ConversionRate = $request_body_array['ConversionRate'] ?? 1;
$CostInBase = (float) $request_body_array['CostInBase'] ?? 0;
$tds = (float) $request_body_array['TDS'] ?? 0;
$FromAccount = $request_body_array['FromAccount'] ?? null;
$ToAccount = $request_body_array['ToAccount'] ?? null;
$PaymentMode = $request_body_array['PaymentMode'] ?? null;
$currentData = date("Y-m-d H:i:s");
$PaymentDate = $request_body_array['PaymentDate'] ?? $currentData;
$TransactionReference = $request_body_array['TransactionReference'] ?? null;
$Remarks = $request_body_array['Remarks'] ?? null;
$AgentSysId = $request_body_array['AgentSysId'] ?? null;
$SupplierMdl = new Webservice_Model_Supplier();
$paymentDetails = $SupplierMdl->getSupplierPayment($SupplierSysId, $TPSysId);
if (!$paymentDetails) {
$packageHistory = [
"SupplierId" => $SupplierSysId,
"PackageId" => $TPSysId,
"FCurrencyType" => $FCurrencyType,
"TCurrencyType" => $TCurrencyType,
"TotalCost" => $Amount,
"TotalTax" => (float) $Tax,
"Discount" => (float) $discount,
"Commission" => $Commission,
"TotalBankCharges" => (float) $BankCharges,
"TotalPaid" => $TotalPayableAmount,
"PaymentDate" => $currentData,
"TotalOtherCharges" => (float) $OtherCharges,
"Remarks" => $Remarks,
"CreatedDate" => $currentData,
"UpdatedDate" => $currentData
];
$PaymentId = $modelTBOMdl->insertData('TB_Supplier_Payment', $packageHistory);
} else {
$PaymentId = $paymentDetails['Id'];
$whereCondition = array('Id =?' => $PaymentId);
$packageHistory = array(
'TotalTax' => new Zend_Db_Expr("TotalTax + " . (float) $Tax),
'TotalBankCharges' => new Zend_Db_Expr("TotalBankCharges + " . (float) $BankCharges),
'TotalPaid' => new Zend_Db_Expr("TotalPaid + " . (float) $TotalPayableAmount),
'Discount' => $discount, //new Zend_Db_Expr("$discount + " . (float) $discount),
'TotalOtherCharges' => $OtherCharges, //new Zend_Db_Expr("TotalOtherCharges + " . (float) $OtherCharges),
'UpdatedDate' => $currentData
);
$modelTBOMdl->updateData('TB_Supplier_Payment', $packageHistory, $whereCondition);
}
if ($TotalPayableAmount > 0) {
$walletRow = $SupplierMdl->getSupplierWalletDetails($SupplierSysId);
if (!$walletRow) {
$supplierDetails = $SupplierMdl->getSupplierDetails($SupplierSysId);
$CurrencyType = $supplierDetails['CurrencyType'];
$supplierWalletData = [
"SupplierSysId" => $SupplierSysId,
"BalanceAmount" => 0,
"CurrencyType" => $CurrencyType,
"UpdateDate" => $currentData,
"IsMarkForDel" => 0,
"IsActive" => 1
];
$WalletId = $modelTBOMdl->insertData('TB_Supplier_Wallet', $supplierWalletData);
} else {
$WalletId = $walletRow['WalletId'];
}
if ($PaymentMode == 19) {
$newTotalPayableAmount = $TotalPayableAmount;
$saveData = [
'BalanceAmount' => new Zend_Db_Expr("BalanceAmount - $newTotalPayableAmount"),
'UpdateDate' => date('Y-m-d H:i:s'),
'IsMarkForDel' => 0,
'IsActive' => 1,
];
$whereQuery1 = array('WalletId = ? ' => $WalletId, 'SupplierSysId = ? ' => $SupplierSysId);
$modelTBOMdl->updateData('TB_Supplier_Wallet', $saveData, $whereQuery1);
$BalanceAmountSP = $agencyMdl->getCreditBalanceSupplier($WalletId, $SupplierSysId);
$dt = DateTime::createFromFormat('U.u', microtime(true));
$dt->setTimezone(new DateTimeZone('Asia/Kolkata'));
$formatted = $dt->format("Y-m-d H:i:s") . '.' . substr($dt->format("u"), 0, 3);
$walletHistory = [
"WalletId" => $WalletId,
"SupplierId" => $SupplierSysId,
"TPSysId" => $TPSysId,
"TransactionType" => 0, // Credit // 0 Debit
"InvoiceNo" => $InvoiceNo,
"ReferenceType" => 'Against Invoice - ' . $TPSysId . '/' . $InvoiceNo,
"CurrencyType" => $FCurrencyType,
"TotalAmount" => $newTotalPayableAmount,
"PaidAmount" => $newTotalPayableAmount,
"BankCharges" => $BankCharges,
"OtherCharges" => $OtherCharges,
"CGST" => $CGST,
"SGST" => $SGST,
"IGST" => $IGST,
"GSTNo" => $GSTNo,
"GSTInput" => $GSTInput,
"ReferenceId" => $PaymentId,
"Balance" => $BalanceAmountSP,
"TransactionDate" => $currentData,
"FromAccount" => $FromAccount,
"ToAccount" => $ToAccount,
"PaymentMode" => $PaymentMode,
"TransactionReference" => $TransactionReference,
"Remarks" => $Remarks,
"AgentSysId" => $AgentSysId,
"IsApproved" => 1,
"OTPCode" => 0,
"CodeValidFrom" => $currentData,
"CodeValidTo" => $currentData,
"CreateDate" => $currentData,
"UpdateDate" => $formatted,
"IsActive" => 1,
"IsMarkForDel" => 0,
"BillId" => $BillId > 0 ? $BillId : null
];
$modelTBOMdl->insertData('TB_Supplier_Wallet_History', $walletHistory);
} else {
if ($PaymentType == 'advance') {
$ReferenceType = 'Advanced Against Proposal - ' . $TPSysId;
} else {
$ReferenceType = 'Against Invoice - ' . $TPSysId . '/' . $InvoiceNo;
}
$saveData = [
'BalanceAmount' => new Zend_Db_Expr("BalanceAmount + $TotalPayableAmount"),
'UpdateDate' => date('Y-m-d H:i:s'),
'IsMarkForDel' => 0,
'IsActive' => 1,
];
$whereQuery1 = array('WalletId = ? ' => $WalletId, 'SupplierSysId = ? ' => $SupplierSysId);
$modelTBOMdl->updateData('TB_Supplier_Wallet', $saveData, $whereQuery1);
$BalanceAmountSP = $agencyMdl->getCreditBalanceSupplier($WalletId, $SupplierSysId);
$dt = DateTime::createFromFormat('U.u', microtime(true));
$dt->setTimezone(new DateTimeZone('Asia/Kolkata'));
$formatted = $dt->format("Y-m-d H:i:s") . '.' . substr($dt->format("u"), 0, 3);
$walletHistory = [
"WalletId" => $WalletId,
"SupplierId" => $SupplierSysId,
"TPSysId" => $TPSysId,
"TransactionType" => 1,
"InvoiceNo" => $InvoiceNo,
"ReferenceType" => $ReferenceType,
"CurrencyType" => $FCurrencyType,
"TotalAmount" => $TotalPayableAmount,
"PaidAmount" => $TotalPayableAmount,
"BankCharges" => $BankCharges,
"OtherCharges" => $OtherCharges,
"CGST" => $CGST,
"SGST" => $SGST,
"IGST" => $IGST,
"GSTNo" => $GSTNo,
"GSTInput" => $GSTInput,
"ReferenceId" => $PaymentId,
"Balance" => $BalanceAmountSP,
"TransactionDate" => $currentData,
"FromAccount" => $FromAccount,
"ToAccount" => $ToAccount,
"PaymentMode" => $PaymentMode,
"TransactionReference" => $TransactionReference,
"Remarks" => $Remarks,
"AgentSysId" => $AgentSysId,
"IsApproved" => 1,
"OTPCode" => 0,
"CodeValidFrom" => $currentData,
"CodeValidTo" => $currentData,
"CreateDate" => $currentData,
"UpdateDate" => $formatted,
"IsActive" => 1,
"IsMarkForDel" => 0,
"BillId" => $BillId > 0 ? $BillId : null
];
$modelTBOMdl->insertData('TB_Supplier_Wallet_History', $walletHistory);
}
$servicesdelated = array("IsActive" => 0, "IsMarkForDel" => 1);
$whereServicesCondition = array('PaymentId =?' => $PaymentId);
$modelTBOMdl->updateData('TB_Supplier_Payment_Services', $servicesdelated, $whereServicesCondition);
$services = $request_body_array['Services'] ?? [];
foreach ($services as $service) {
$PlanType = $service['PlanType'] ?? null;
$Cost = $service['Cost'] ?? 0;
$ServiceCurrencyType = (int) $service['CurrencyType'] ?? null;
$VersionId = $service['VersionId'] ?? null;
$checkServicesArray = $SupplierMdl->checkServices($TPSysId, $PlanType, $VersionId);
$packageServiceData = [
"PaymentId" => $PaymentId,
"PackageId" => $TPSysId,
"PlanType" => $PlanType,
"SupplierId" => $SupplierSysId,
"VersionId" => $VersionId,
"CurrencyType" => $ServiceCurrencyType > 1 ? $ServiceCurrencyType : null,
"Cost" => $Cost,
"Remarks" => "",
"CreatedDate" => $currentData,
"UpdatedDate" => $currentData,
"IsActive" => 1,
"IsMarkForDel" => 0
];
if (!$checkServicesArray) {
$modelTBOMdl->insertData('TB_Supplier_Payment_Services', $packageServiceData);
} else {
unset($packageServiceData['CreatedDate']);
unset($packageServiceData['PaymentId']);
$serviceId = $checkServicesArray['Id'];
$whereServicesCondition = array('Id =?' => $serviceId);
$modelTBOMdl->updateData('TB_Supplier_Payment_Services', $packageServiceData, $whereServicesCondition);
}
}
$paymenyHistory = [
"PaymentId" => $PaymentId,
"SupplierId" => $SupplierSysId,
"TPSysId" => $TPSysId,
"TransactionType" => 1, // Credit // 0 Debit
"InvoiceNo" => $InvoiceNo,
"ReferenceType" => 'TDS Ageinst ',
"CurrencyType" => $FCurrencyType,
"TotalAmount" => $Amount,
"PaidAmount" => $TotalPayableAmount,
"BankCharges" => $BankCharges,
"OtherCharges" => $OtherCharges,
"CGST" => $CGST,
"SGST" => $SGST,
"IGST" => $IGST,
"GSTNo" => $GSTNo,
"GSTInput" => $GSTInput,
"ReferenceId" => $PaymentId,
"ConversionRate" => $ConversionRate,
"CostInBase" => $CostInBase,
"TransactionDate" => $currentData,
"FromAccount" => $FromAccount,
"ToAccount" => $ToAccount,
"PaymentMode" => $PaymentMode,
"PaymentDate" => $PaymentDate,
"TDS" => $tds,
"TransactionReference" => $TransactionReference,
"Remarks" => $Remarks,
"AgentSysId" => $AgentSysId,
"IsApproved" => 1,
"CreateDate" => $currentData,
"UpdateDate" => $currentData
];
$modelTBOMdl->insertData('TB_Supplier_Payment_History', $paymenyHistory);
$returnResponse['status'] = true;
$returnResponse['message'] = 'Payment and services saved successfully.';
if ($BillId > 0) {
$billDataUpdated = array(
"IsGSTPaid" => True,
"PaidAmount" => new Zend_Db_Expr("PaidAmount + " . (float) $TotalPayableAmount)
);
$whereServicesCondition = array(
'BillId =?' => $BillId,
'ProposalId =?' => $TPSysId
);
$modelTBOMdl->updateData('TB_Supplier_Bill_Items', $billDataUpdated, $whereServicesCondition);
$whereBillCondition = array('BillId =?' => $BillId);
$paidAmountUpdate = array("PaidAmount" => new Zend_Db_Expr("PaidAmount + " . (float) $TotalPayableAmount));
$modelTBOMdl->updateData('TB_Supplier_Bill', $paidAmountUpdate, $whereBillCondition);
}
} else {
$returnResponse['message'] = 'Invalid API Key';
}
}
// } catch (Zend_Exception $e) {
// $returnResponse['message'] = $e->getMessage();
// }
}
}
}
echo json_encode($returnResponse);
exit;
}
public function getBillSupplierWiseAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$request_body_json = file_get_contents('php://input');
$headers = getallheaders();
$returnResponse = ["status" => false];
$SupplierMdl = new Webservice_Model_Supplier();
if (!empty($headers)) {
$apiKey = isset($headers['SecurityKey']) ? trim($headers['SecurityKey']) : false;
if (!empty($request_body_json)) {
$request_body_array = json_decode($request_body_json, true);
if (!is_array($request_body_array)) {
echo json_encode(["status" => false, "message" => "Invalid JSON input"]);
exit;
}
if ($apiKey) {
try {
$agencyMdl = new Travel_Model_TblAgency();
$getAgencySysId = $agencyMdl->checkAgency($apiKey);
$AgencySysId = isset($getAgencySysId['AgencySysId']) ? (int) $getAgencySysId['AgencySysId'] : 0;
$SupplierSysId = (int) $request_body_array['SupplierSysId'] ?? null;
if ($AgencySysId > 0 && $SupplierSysId > 0) {
$getSupplierDetails = $SupplierMdl->getBillSupplierAgencyWise($SupplierSysId, $AgencySysId);
$returnResponse = ["status" => true, "billDetails" => $getSupplierDetails];
}
} catch (Zend_Exception $e) {
$returnResponse = ["status" => false, "errorMessage" => $e->getMessage()];
}
}
}
}
echo json_encode($returnResponse);
exit;
}
public function checkdateAction() {
echo phpinfo();
date_default_timezone_set('Asia/Kolkata');
$dt = DateTime::createFromFormat('U.u', microtime(true));
$dt->setTimezone(new DateTimeZone('Asia/Kolkata'));
echo $formatted = $dt->format("Y-m-d H:i:s") . '.' . substr($dt->format("u"), 0, 3);
exit;
}
}