Merge branch 'uat' of bitbucket.org:venbainformationtechnology/vb_book into uat

This commit is contained in:
VE10-Sanjeev 2024-11-06 12:07:00 +00:00
commit 5219d10f5c
5669 changed files with 107784 additions and 22719 deletions

2
.env Normal file → Executable file
View File

@ -154,7 +154,7 @@ APP_TIMEZONE = 'Asia/Kolkata'
# WAAI_TOKEN = '6568739969f28'
# WAAI_INSTANCE = '656876690A9FD'
app.debug = true;
# for Testing Purpose
# 4th Account - Dummy Account by sanjeev created on 10th april 24 Testing purpose
# Dummy Office Mail ID - venba.it.chennai@venbainfotech.com

0
LICENSE Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
app/.htaccess Normal file → Executable file
View File

0
app/Common.php Normal file → Executable file
View File

0
app/Config/App.php Normal file → Executable file
View File

2
app/Config/Autoload.php Normal file → Executable file
View File

@ -97,5 +97,5 @@ class Autoload extends AutoloadConfig
* @var string[]
* @phpstan-var list<string>
*/
public $helpers = [];
public $helpers = ['date_picker'];
}

0
app/Config/Boot/development.php Normal file → Executable file
View File

0
app/Config/Boot/production.php Normal file → Executable file
View File

0
app/Config/Boot/testing.php Normal file → Executable file
View File

0
app/Config/CURLRequest.php Normal file → Executable file
View File

0
app/Config/Cache.php Normal file → Executable file
View File

20
app/Config/Constants.php Normal file → Executable file
View File

@ -130,5 +130,25 @@ define('SEND_WAAI_GROUP_URL', 'https://waai.in/api/send_group');
define('EXPIRAY_NOTIFY_TEMPLATE_EMAIL','EXPIRAY_NOTIFY_TEMPLATE_EMAIL');
define('EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP','EXPIRAY_NOTIFY_TEMPLATE_WHATSAPP');
define('PAYTM_ENVIRONMENT', 'TEST'); // PROD
//Change this constant's value with Merchant key received from Paytm.
define('PAYTM_MERCHANT_KEY', 'wmy4JaBcar3nK97G');
//Change this constant's value with MID (Merchant ID) received from Paytm.
define('PAYTM_MERCHANT_MID', 'VWJbeA80075161016380');
//Change this constant's value with Website name received from Paytm.
define('PAYTM_MERCHANT_WEBSITE', 'WEBSTAGING');
$PAYTM_STATUS_QUERY_NEW_URL='https://securegw-stage.paytm.in/merchant-status/getTxnStatus';
$PAYTM_TXN_URL='https://securegw-stage.paytm.in/theia/processTransaction';
if (PAYTM_ENVIRONMENT == 'PROD') {
$PAYTM_STATUS_QUERY_NEW_URL='https://securegw.paytm.in/merchant-status/getTxnStatus';
$PAYTM_TXN_URL='https://securegw.paytm.in/theia/processTransaction';
}
define('PAYTM_REFUND_URL', '');
define('PAYTM_STATUS_QUERY_URL', $PAYTM_STATUS_QUERY_NEW_URL);
define('PAYTM_STATUS_QUERY_NEW_URL', $PAYTM_STATUS_QUERY_NEW_URL);
define('PAYTM_TXN_URL', $PAYTM_TXN_URL);

0
app/Config/ContentSecurityPolicy.php Normal file → Executable file
View File

0
app/Config/Cookie.php Normal file → Executable file
View File

0
app/Config/Database.php Normal file → Executable file
View File

0
app/Config/DocTypes.php Normal file → Executable file
View File

0
app/Config/Email.php Normal file → Executable file
View File

0
app/Config/Encryption.php Normal file → Executable file
View File

0
app/Config/Events.php Normal file → Executable file
View File

0
app/Config/Exceptions.php Normal file → Executable file
View File

0
app/Config/Feature.php Normal file → Executable file
View File

0
app/Config/Filters.php Normal file → Executable file
View File

0
app/Config/ForeignCharacters.php Normal file → Executable file
View File

0
app/Config/Format.php Normal file → Executable file
View File

0
app/Config/Generators.php Normal file → Executable file
View File

0
app/Config/Honeypot.php Normal file → Executable file
View File

0
app/Config/Images.php Normal file → Executable file
View File

0
app/Config/Kint.php Normal file → Executable file
View File

0
app/Config/Logger.php Normal file → Executable file
View File

0
app/Config/Migrations.php Normal file → Executable file
View File

0
app/Config/Mimes.php Normal file → Executable file
View File

0
app/Config/Modules.php Normal file → Executable file
View File

0
app/Config/Pager.php Normal file → Executable file
View File

0
app/Config/Paths.php Normal file → Executable file
View File

0
app/Config/Publisher.php Normal file → Executable file
View File

11
app/Config/Routes.php Normal file → Executable file
View File

@ -145,8 +145,12 @@ $routes->get('print_address_landscape/(:num)', 'Invoice::print_address_landscape
$routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp');
$routes->match(['get','post'],'/mem_inv_rp','Invoice::general_membership_inv_rp');
$routes->match(['get','post'],'/itemwise_report','Invoice::itemwise_report');
$routes->match(['get','post'],'/report_userwise_and_eventwise','Invoice::userwise_eventwise_report');
$routes->match(['get','post'],'/expired_customer_report','Invoice::expired_customer_report');
$routes->match(['get','post'],'/received_payments_report','Invoice::received_payments_report');
$routes->match(['get','post'],'/book_publishwise_Report','Invoice::book_publishwise_Report');
$routes->match(['get','post'],'/itemwise_report_with_payment_method','Invoice::itemwise_report_with_payment_method');
@ -184,7 +188,12 @@ $routes->post('api/(:any)', 'ApiIntegration::api_integration/$1');
$routes->get('get_country', 'Customer::get_country_list');
$routes->post('qucik_add_addresses', 'Customer::qucik_add_addresses');
#Payment Routes
$routes->match(['get','post'],'/subscription_renewal','Payment::index/');
$routes->match(['get','post'],'/payer','Payment::iniatepay/');
$routes->match(['get','post'],'/pay','Payment::pay/');
$routes->match(['get','post'],'/tresponse','Payment::tresponse/');
$routes->match(['get','post'],'/subscription_renewal/(:any)','Payment::index/$1');
// $routes->group("api", function ($routes) {
// // $routes->post("create_products/", "ApiIntegration::save_book_details");

0
app/Config/Security.php Normal file → Executable file
View File

0
app/Config/Services.php Normal file → Executable file
View File

0
app/Config/Session.php Normal file → Executable file
View File

0
app/Config/Toolbar.php Normal file → Executable file
View File

0
app/Config/UserAgents.php Normal file → Executable file
View File

0
app/Config/Validation.php Normal file → Executable file
View File

0
app/Config/View.php Normal file → Executable file
View File

0
app/Controllers/Address.php Normal file → Executable file
View File

0
app/Controllers/ApiIntegration.php Normal file → Executable file
View File

2
app/Controllers/BaseController.php Normal file → Executable file
View File

@ -65,7 +65,7 @@ abstract class BaseController extends Controller
echo "This is a command-line request.";
// echo $requestedRoute;
} else {
if ($requestedRoute !== '/login' && $requestedRoute !== '/authenticate' && $requestedRoute !== '/auth_confirm_mail' && $requestedRoute !== '/auth_reset_password' && $requestedRoute !== 'auth_reset_password_save' && $uri->getSegment(1) != 'getExpCustomerDetail'&& $uri->getSegment(1) != 'download_invoice_pdf') {
if ($requestedRoute !== '/login' && $requestedRoute !== '/authenticate'&& $requestedRoute !== '/pay' && $requestedRoute !== '/auth_confirm_mail' && $requestedRoute !== '/auth_reset_password' && $requestedRoute !== 'auth_reset_password_save' && $requestedRoute !== '/subscription_renewal'&& $requestedRoute !== '/tresponse' && strpos($requestedRoute, '/subscription_renewal/') === false && $uri->getSegment(1) != 'getExpCustomerDetail'&& $uri->getSegment(1) != 'download_invoice_pdf') {
$this->authData = $this->session_log();
}
}

0
app/Controllers/Business.php Normal file → Executable file
View File

0
app/Controllers/Customer.php Normal file → Executable file
View File

0
app/Controllers/Event.php Normal file → Executable file
View File

0
app/Controllers/Home.php Normal file → Executable file
View File

125
app/Controllers/Invoice.php Normal file → Executable file
View File

@ -8,6 +8,7 @@ use App\Models\InvoiceModel;
use App\Models\BusinessModel;
use App\Models\BooksModel;
use App\Helpers\NotificationHelper;
use App\Helpers\date_picker;
use Mpdf\Mpdf;
use Dompdf\Dompdf;
@ -954,12 +955,13 @@ class Invoice extends BaseController
} else {
$dateParts = explode(' - ', $this->request->getVar('date'));
$fromDate = $dateParts[0];
$toDate = $dateParts[1];
$dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
$dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
$dates = datePicker($dateParts);
// $fromDate = $dateParts[0];
// $toDate = $dateParts[1];
// $dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
// $dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
$model = new InvoiceModel();
$data['expired_customers'] = $model->getExpiredCustomers($dateTime->format('Y-m-d'), $dateTime1->format('Y-m-d'));
$data['expired_customers'] = $model->getExpiredCustomers($dates['dateTime']->format('Y-m-d'), $dates['dateTime1']->format('Y-m-d'));
$data['selected_data'] = $this->request->getVar('date');
$this->logger->info("Itemwise Report ");
}
@ -970,29 +972,112 @@ class Invoice extends BaseController
public function itemwise_report()
{
$model = new InvoiceModel();
if ($this->request->getmethod() == 'get') {
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data();
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Bookswise Report';
$this->render_page('report_itemwise', $data);
$this->logger->info("Itemwise Report getMETHOD ");
$data['selected_data'] = "";
} else {
if ($this->request->getPost('export_csv')) {
$value = $this->request->getPost('value');
if (!isset($value)){
// Handle CSV export
$this->exportCsv();
} else {
// Handle date range filter
$this->logger->info("Itemwise Report CSV ");
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data();
$this->logger->info("Itemwise Report ");
$data['page_name'] = 'Bookswise Report';
$this->exportCsv();
$this->render_page('report_itemwise', $data);
}
else{
// Handle date range filter
$this->logger->info("Itemwise Report getPOST ");
$dateParts = explode(' - ', $this->request->getVar('date'));
$dates = datePicker($dateParts);
// $fromDate = $dateParts[0];
// $toDate = $dateParts[1];
// $dateTime = \DateTime::createFromFormat('d/m/Y', $fromDate);
// $dateTime1 = \DateTime::createFromFormat('d/m/Y', $toDate);
$model = new InvoiceModel();
$data['report_data'] = $model->itemwise_report_data($dates['dateTime']->format('Y-m-d'), $dates['dateTime1']->format('Y-m-d'));
$data['selected_data'] = $this->request->getVar('date');
$this->logger->info('dsvawvsd');
$this->logger->info("Itemwise Report2 ");
}
}
$data['page_name'] = 'Bookswise Report';
$this->render_page('report_itemwise', $data);
}
public function userwise_eventwise_report(){
$model = new InvoiceModel();
if ($this->request->getMethod() == 'get'){
$data['report_data'] = $model->userwise_eventwise_report();
$data['selected_data'] = '';
$this->logger->info("Inside GEt method");
}
else{
$dateParts = explode(' - ', $this->request->getVar('date'));
$dates = datePicker($dateParts);
$model = new InvoiceModel();
$data['report_data'] = $model->userwise_eventwise_report($dates['dateTime']->format('Y-m-d'), $dates['dateTime1']->format('Y-m-d'));
$data['selected_data'] = $this->request->getVar('date');
$this->logger->info('dsvawvsd');
$this->logger->info("Itemwise Report2 ");
}
$data['page_name'] = 'User and Event wise Report';
$this->render_page('report_userwise_and_eventwise',$data);
}
public function received_payments_report(){
$model = new InvoiceModel();
if ($this->request->getMethod() == 'get'){
$data['payment_data'] = $model->getPaymentReport();
$data['selected_data'] = "";
$this->logger->info("Inside the get method");
}
else{
$dateParts = explode(' - ',$this->request->getVar(('date')));
$dates = datePicker($dateParts);
// $fromDate = $dateParts[0];
// $toDate = $dateParts[1];
// $dateTime = \DateTime::createFromFormat('d/m/Y',$fromDate);
// $dateTime1 = \DateTime::createFromFormat('d/m/Y',$toDate);
$data['payment_data'] = $model->getPaymentReport($dates['dateTime']->format('Y-m-d'), $dates['dateTime1']->format('Y-m-d'));
$data['selected_data'] = $this->request->getVar('date');
}
$data['page_name'] = 'Received Payments Report';
$this->render_page('received_payments_report',$data);
}
public function itemwise_report_with_payment_method(){
$model = new InvoiceModel();
if ($this->request->getMethod() == 'get'){
$data['report_data'] = $model->itemwise_report_data_with_payment_method();
$data['selected_data'] = "";
$this->logger->info("Inside the get method");
}
else{
$dateParts = explode(' - ',$this->request->getVar(('date')));
$dates = datePicker($dateParts);
// $fromDate = $dateParts[0];
// $toDate = $dateParts[1];
// $dateTime = \DateTime::createFromFormat('d/m/Y',$fromDate);
// $dateTime1 = \DateTime::createFromFormat('d/m/Y',$toDate);
$data['report_data'] = $model->itemwise_report_data_with_payment_method($dates['dateTime']->format('Y-m-d'), $dates['dateTime1']->format('Y-m-d'));
$data['selected_data'] = $this->request->getVar('date');
}
$data['page_name'] = 'Sales By Books';
// var_dump($data);
// die();
$this->render_page('itemwise_report_with_payment_method',$data);
}
}
private function exportCsv()
{

View File

@ -630,7 +630,7 @@ class Notifications extends BaseController
$emailContent = str_replace("{USER_NAME}", $fullName, $emailContent);
$emailContent = str_replace("{SCHEME_NAME}", $schemename, $emailContent);
$emailContent = str_replace("{EXPIRY_DATE}", $expirydate, $emailContent);
$emailData = [
'template_name' => 'EXPIRAY_NOTIFY_TEMPLATE_EMAIL',
'recipient_email' => $row['email'],

128
app/Controllers/Payment.php Normal file
View File

@ -0,0 +1,128 @@
<?php
namespace App\Controllers;
use App\Models\CustomerModel;
use App\Models\SchemeModel;
use App\Models\SubscriptionModel;
use paytmpg\pg\request\InitiateTransactionRequestBody;
use paytmpg\pg\response\InitiateTransactionResponse;
use paytmpg\pg\constants\MerchantProperties;
use paytmpg\pg\process\Transaction;
require_once('vendor/autoload.php');
define('PROJECT', 'vendor/paytm/paytm-pg');
class Payment extends BaseController
{
public function __construct() {
helper('encdec_paytm');
}
public function index($subscriptionID = null)
{
$model = new CustomerModel();
$model2 = new SubscriptionModel();
if ($subscriptionID != null){
$customer_details = $model->get_customer_details_by_customer_id($subscriptionID);
$scheme = $model2->get_subscription_details_by_customerID($subscriptionID);
$response = [
'customer_details' => $customer_details,
'scheme' => $scheme,
'subscriptionID' =>$subscriptionID
];
return view('subscription_renewal',$response);
}
else{
if ($this->request->getMethod() == 'get') {
return view('subscription_renewal');
}
else {
//echo "inside else";die();
$customer_id = $this->request->getPost('customerID');
$customer_details = $model->get_customer_details_by_customer_id($customer_id);
$scheme = $model2->get_subscription_details_by_customerID($customer_id);
$response = [
'customer_details' => $customer_details,
'scheme' => $scheme
];
//var_dump($response);die();
return $this->response->setJSON($response);
}
}
}
public function iniatepay(){
return view('pay');
}
public function pay()
{
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/mobile/i', $userAgent)) {
// Mobile device detected
$payment_method = "mobile";
} else {
// Desktop device detected
$payment_method = 'website' ;
}
$checkSum = "";
$paramList = array();
$CUST_ID = $this->request->getPost("CustomerID");
$ORDER_ID = uniqid($CUST_ID . "_");
$INDUSTRY_TYPE_ID = "Retail";
$CHANNEL_ID = ($payment_method == "mobile") ? "WAP" : "WEB";
$TXN_AMOUNT = $this->request->getPost("amount");
// Create an array having all required parameters for creating checksum.
$paramList["MID"] = PAYTM_MERCHANT_MID;
$paramList["ORDER_ID"] = $ORDER_ID;
$paramList["CUST_ID"] = $CUST_ID;
$paramList["INDUSTRY_TYPE_ID"] = $INDUSTRY_TYPE_ID;
$paramList["CHANNEL_ID"] = $CHANNEL_ID;
$paramList["TXN_AMOUNT"] = $TXN_AMOUNT;
$paramList["WEBSITE"] = PAYTM_MERCHANT_WEBSITE;
$paramList["CALLBACK_URL"] = base_url('tresponse');
//Here checksum string will return by getChecksumFromArray() function.
$data['checkSum'] = getChecksumFromArray($paramList, PAYTM_MERCHANT_KEY);
$data['paramList'] = $paramList;
//print_r($paramList);die();
return view('/tresponse', $data);
}
public function tresponse() {
$paytmChecksum = "";
$paramList = array();
$isValidChecksum = "FALSE";
$paramList = $_POST;
$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : "";
//will return TRUE or FALSE string.
$isValidChecksum = verifychecksum_e($paramList, PAYTM_MERCHANT_KEY, $paytmChecksum);
//var_dump($isValidChecksum);die();
if($isValidChecksum == "TRUE") {
if ($_POST["STATUS"] == "TXN_SUCCESS") {
echo "<b>Transaction status is success</b>" . "<br/>";
} else {
echo "<b>Transaction status is failure</b>" . "<br/>";
}
if (isset($_POST) && count($_POST)>0 ) {
foreach($_POST as $paramName => $paramValue) {
echo "<br/>" . $paramName . " = " . $paramValue;
}
}
} else {
echo "<b>Checksum mismatched.</b>";
}
}
}

0
app/Controllers/Scheme.php Normal file → Executable file
View File

0
app/Controllers/Subscription.php Normal file → Executable file
View File

0
app/Controllers/email_temp.php Normal file → Executable file
View File

0
app/Database/Migrations/.gitkeep Normal file → Executable file
View File

0
app/Database/Seeds/.gitkeep Normal file → Executable file
View File

0
app/Filters/.gitkeep Normal file → Executable file
View File

0
app/Helpers/.gitkeep Normal file → Executable file
View File

0
app/Helpers/NotificationHelper.php Normal file → Executable file
View File

0
app/Helpers/apiIntegration_helper.php Normal file → Executable file
View File

View File

@ -0,0 +1,19 @@
<?php
/**
* Formats the given date range from string 'd/m/Y' to date object'd-m-Y'.
*
* @param array $dateParts An array containing the start and end dates
* in 'd/m/Y' format or in any format where the datatype is string.
* @return array An array with formatted start and end dates in 'd-m-Y' format.
*/
function datePicker($dateParts){
$fromDate = $dateParts[0];
$toDate = $dateParts[1];
$date['dateTime']= \DateTime::createFromFormat('d/m/Y', $fromDate);
$date['dateTime1'] = \DateTime::createFromFormat('d/m/Y', $toDate);
return $date;
}
?>

View File

@ -0,0 +1,252 @@
<?php
function encrypt_e($input, $ky) {
$key = html_entity_decode($ky);
$iv = "@@@@&&&&####$$$$";
$data = openssl_encrypt ( $input , "AES-128-CBC" , $key, 0, $iv );
return $data;
}
function decrypt_e($crypt, $ky) {
$key = html_entity_decode($ky);
$iv = "@@@@&&&&####$$$$";
$data = openssl_decrypt ( $crypt , "AES-128-CBC" , $key, 0, $iv );
return $data;
}
function generateSalt_e($length) {
$random = "";
srand((double) microtime() * 1000000);
$data = "AbcDE123IJKLMN67QRSTUVWXYZ";
$data .= "aBCdefghijklmn123opq45rs67tuv89wxyz";
$data .= "0FGH45OP89";
for ($i = 0; $i < $length; $i++) {
$random .= substr($data, (rand() % (strlen($data))), 1);
}
return $random;
}
function checkString_e($value) {
if ($value == 'null')
$value = '';
return $value;
}
function getChecksumFromArray($arrayList, $key, $sort=1) {
if ($sort != 0) {
ksort($arrayList);
}
$str = getArray2Str($arrayList);
$salt = generateSalt_e(4);
$finalString = $str . "|" . $salt;
$hash = hash("sha256", $finalString);
$hashString = $hash . $salt;
$checksum = encrypt_e($hashString, $key);
return $checksum;
}
function getChecksumFromString($str, $key) {
$salt = generateSalt_e(4);
$finalString = $str . "|" . $salt;
$hash = hash("sha256", $finalString);
$hashString = $hash . $salt;
$checksum = encrypt_e($hashString, $key);
return $checksum;
}
function verifychecksum_e($arrayList, $key, $checksumvalue) {
$arrayList = removeCheckSumParam($arrayList);
ksort($arrayList);
$str = getArray2StrForVerify($arrayList);
$paytm_hash = decrypt_e($checksumvalue, $key);
$salt = substr($paytm_hash, -4);
$finalString = $str . "|" . $salt;
$website_hash = hash("sha256", $finalString);
$website_hash .= $salt;
$validFlag = "FALSE";
if ($website_hash == $paytm_hash) {
$validFlag = "TRUE";
} else {
$validFlag = "FALSE";
}
return $validFlag;
}
function verifychecksum_eFromStr($str, $key, $checksumvalue) {
$paytm_hash = decrypt_e($checksumvalue, $key);
$salt = substr($paytm_hash, -4);
$finalString = $str . "|" . $salt;
$website_hash = hash("sha256", $finalString);
$website_hash .= $salt;
$validFlag = "FALSE";
if ($website_hash == $paytm_hash) {
$validFlag = "TRUE";
} else {
$validFlag = "FALSE";
}
return $validFlag;
}
function getArray2Str($arrayList) {
$findme = 'REFUND';
$findmepipe = '|';
$paramStr = "";
$flag = 1;
foreach ($arrayList as $key => $value) {
$pos = strpos($value, $findme);
$pospipe = strpos($value, $findmepipe);
if ($pos !== false || $pospipe !== false)
{
continue;
}
if ($flag) {
$paramStr .= checkString_e($value);
$flag = 0;
} else {
$paramStr .= "|" . checkString_e($value);
}
}
return $paramStr;
}
function getArray2StrForVerify($arrayList) {
$paramStr = "";
$flag = 1;
foreach ($arrayList as $key => $value) {
if ($flag) {
$paramStr .= checkString_e($value);
$flag = 0;
} else {
$paramStr .= "|" . checkString_e($value);
}
}
return $paramStr;
}
function redirect2PG($paramList, $key) {
$hashString = getchecksumFromArray($paramList, $key);
$checksum = encrypt_e($hashString, $key);
}
function removeCheckSumParam($arrayList) {
if (isset($arrayList["CHECKSUMHASH"])) {
unset($arrayList["CHECKSUMHASH"]);
}
return $arrayList;
}
function getTxnStatus($requestParamList) {
return callAPI(PAYTM_STATUS_QUERY_URL, $requestParamList);
}
function getTxnStatusNew($requestParamList) {
return callNewAPI(PAYTM_STATUS_QUERY_NEW_URL, $requestParamList);
}
function initiateTxnRefund($requestParamList) {
$CHECKSUM = getRefundChecksumFromArray($requestParamList,PAYTM_MERCHANT_KEY,0);
$requestParamList["CHECKSUM"] = $CHECKSUM;
return callAPI(PAYTM_REFUND_URL, $requestParamList);
}
function callAPI($apiURL, $requestParamList) {
$jsonResponse = "";
$responseParamList = array();
$JsonData =json_encode($requestParamList);
$postData = 'JsonData='.urlencode($JsonData);
$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($postData))
);
$jsonResponse = curl_exec($ch);
$responseParamList = json_decode($jsonResponse,true);
return $responseParamList;
}
function callNewAPI($apiURL, $requestParamList) {
$jsonResponse = "";
$responseParamList = array();
$JsonData =json_encode($requestParamList);
$postData = 'JsonData='.urlencode($JsonData);
$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($postData))
);
$jsonResponse = curl_exec($ch);
$responseParamList = json_decode($jsonResponse,true);
return $responseParamList;
}
function getRefundChecksumFromArray($arrayList, $key, $sort=1) {
if ($sort != 0) {
ksort($arrayList);
}
$str = getRefundArray2Str($arrayList);
$salt = generateSalt_e(4);
$finalString = $str . "|" . $salt;
$hash = hash("sha256", $finalString);
$hashString = $hash . $salt;
$checksum = encrypt_e($hashString, $key);
return $checksum;
}
function getRefundArray2Str($arrayList) {
$findmepipe = '|';
$paramStr = "";
$flag = 1;
foreach ($arrayList as $key => $value) {
$pospipe = strpos($value, $findmepipe);
if ($pospipe !== false)
{
continue;
}
if ($flag) {
$paramStr .= checkString_e($value);
$flag = 0;
} else {
$paramStr .= "|" . checkString_e($value);
}
}
return $paramStr;
}
function callRefundAPI($refundApiURL, $requestParamList) {
$jsonResponse = "";
$responseParamList = array();
$JsonData = json_encode($requestParamList);
$postData = 'JsonData=' . urlencode($JsonData);
$ch = curl_init($refundApiURL);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($postData)
));
$jsonResponse = curl_exec($ch);
$responseParamList = json_decode($jsonResponse, true);
return $responseParamList;
}

0
app/Helpers/financial_year_helper.php Normal file → Executable file
View File

0
app/Helpers/session_helper.php Normal file → Executable file
View File

0
app/Language/.gitkeep Normal file → Executable file
View File

0
app/Language/en/Validation.php Normal file → Executable file
View File

0
app/Libraries/.gitkeep Normal file → Executable file
View File

0
app/Models/.gitkeep Normal file → Executable file
View File

0
app/Models/ApiIntegrationModel.php Normal file → Executable file
View File

0
app/Models/AuthenticationModel.php Normal file → Executable file
View File

0
app/Models/BooksModel.php Normal file → Executable file
View File

0
app/Models/BusinessModel.php Normal file → Executable file
View File

11
app/Models/CustomerModel.php Normal file → Executable file
View File

@ -283,5 +283,16 @@ public function getCategory(){
}
public function get_customer_details_by_customer_id($customer_id)
{
$builder = $this->db->table('customers'); // Specify the main table
$builder->select('customers.customer_id, customers.mobile_no,customers.first_name, customers.last_name,customers.mobile_no,customer_addresses.address_1, customer_addresses.city, customer_addresses.state, customer_addresses.postal_code, customer_addresses.country',customer);
$builder->join('customer_addresses', 'customers.customer_id = customer_addresses.customer_address_id');
$builder->where('customers.customer_id', $customer_id);
$result = $builder->get()->getRowArray(); // Fetch the first matching record as an associative array
return $result;
}
}
?>

0
app/Models/EventModel.php Normal file → Executable file
View File

0
app/Models/HomeModel.php Normal file → Executable file
View File

136
app/Models/InvoiceModel.php Normal file → Executable file
View File

@ -433,16 +433,24 @@ public function get_mem_invoice_data($f_date = null, $t_date = null)
// return $result;
// }
public function itemwise_report_data()
public function itemwise_report_data($f_date = null, $t_date = null)
{
// Fetch invoice data
$query = $this->db->table('invoice')
->select('books.publishers_code, COUNT(invoiceitems.product) as publisher_item_count, books.title as book_name, COUNT(invoiceitems.product) as item_count, SUM(invoiceitems.quantity * invoiceitems.unit_price) as total_cost')
->where('invoice.isactive', 1)
->select('books.publishers_code, COUNT(invoiceitems.product) as publisher_item_count, books.title as book_name, COUNT(invoiceitems.product) as item_count, SUM(invoiceitems.quantity * invoiceitems.unit_price) as total_cost ,DATE_FORMAT(books.publication_date, "%d/%m/%Y") AS book_publication_date');
$query->where('invoice.isactive', 1)
->where('invoice.invoice_type',1)
->where('books.isactive', 1);
// Add date range filter if provided
if ($f_date !== null && $t_date !== null) {
$newf_date = date("Y-m-d", strtotime($f_date));
$newt_date = date("Y-m-d", strtotime($t_date));
$query->where('books.publication_date >=', $newf_date)
->where('books.publication_date <=', $newt_date);
}
$result = $query->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left')
@ -452,7 +460,9 @@ public function itemwise_report_data()
->getResult();
// print_r($result);
// Group by publisher_code and include books
// // Group by publisher_code and include books
// var_dump($result);
// die();
$groupedResult = [];
foreach ($result as $row) {
$publisherCode = $row->publishers_code;
@ -462,6 +472,8 @@ public function itemwise_report_data()
'publisher_item_count' => 0,
'publisher_total_cost' => 0,
'books' => [],
'book_name'=>'',
];
}
@ -472,9 +484,10 @@ public function itemwise_report_data()
'book_name' => $row->book_name,
'item_count' => $row->item_count,
'total_cost' => $row->total_cost,
'book_publication_date' =>$row->book_publication_date,
];
}
return array_values($groupedResult);
}
@ -542,6 +555,119 @@ public function itemwise_report_data_with_publish_code($f_date = null, $t_date =
return $result;
}
public function userwise_eventwise_report($f_date = null, $t_date = null){
$builder = $this->db->table('invoice');
$builder->select([
'users.user_id',
'users.first_name',
'events.event_name',
'COUNT(invoice.created_by) AS books_sold',
'ABS(SUM(invoice.exact_total_amount)) AS total_amount',
'invoice.payment_method',
'invoice.invoice_date'
]);
$builder->join('users', 'users.user_id = invoice.created_by');
$builder->join('events', 'events.event_id = invoice.event_id');
$builder->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id');
$builder->join('books', 'books.book_id = invoiceitems.product');
$builder->where('invoice.event_id <>', 0);
if ($f_date !== null && $t_date !== null) {
$builder->where('invoice.invoice_date >=', $f_date)
->where('invoice.invoice_date <=', $t_date);
}
$builder->groupBy([
'users.user_id',
'users.first_name',
'events.event_name',
'payment_method'
]);
$query = $builder->get();
$results = $query->getResultArray();
return $results;
}
public function getPaymentReport($f_date = null, $t_date = null)
{
$builder = $this->db->table('invoice');
$builder->select('invoice.invoice_number, customers.first_name, invoice.total_amount, invoice.payment_status, invoice.payment_method, invoice.invoice_date');
$builder->join('customers', 'invoice.customer_id = customers.customer_id', 'inner');
if ($f_date !== null && $t_date !== null) {
$builder->where('invoice.invoice_date >=', $f_date)
->where('invoice.invoice_date <=', $t_date);
}
$query = $builder->get();
$results = $query->getResultArray();
return $results;
}
public function itemwise_report_data_with_payment_method($f_date = null, $t_date = null)
{
$builder = $this->db->table('invoice');
$builder->select('books.publishers_code,
COUNT(invoiceitems.product) AS publisher_item_count,
books.title AS book_name,
COUNT(invoiceitems.product) AS item_count,
SUM(invoiceitems.quantity * invoiceitems.unit_price) AS total_cost,
invoice.payment_method,
DATE_FORMAT(invoice.invoice_date, "%d-%m-%Y") AS invoice_date');
$builder->join('invoiceitems', 'invoiceitems.invoice_id = invoice.invoice_id', 'left');
$builder->join('books', 'books.book_id = invoiceitems.product', 'left');
$builder->where('invoice.isactive', 1);
$builder->where('invoice.invoice_type', 1);
$builder->where('books.isactive', 1);
if ($f_date !== null && $t_date !== null) {
$builder->where('invoice_date >=', $f_date)
->where('invoice_date <=', $t_date);
}
$builder->groupBy(['books.publishers_code', 'books.title', 'invoice.payment_method']);
$query = $builder->get();
$results = $query->getResultArray();
$groupedResult = [];
foreach ($results as $row) {
// Use a unique key for each combination of publisher and payment method
$publisherCode = $row['publishers_code'];
$paymentMethod = $row['payment_method'];
$uniqueKey = $publisherCode . '-' . $paymentMethod; // Unique key for grouping
// Initialize the group if it does not exist
if (!isset($groupedResult[$uniqueKey])) {
$groupedResult[$uniqueKey] = (object)[
'publisher_code' => $publisherCode,
'publisher_item_count' => 0,
'publisher_total_cost' => 0,
'books' => [],
'payment_method' => $paymentMethod,
];
}
// Update the groups cumulative values
$groupedResult[$uniqueKey]->publisher_item_count += $row['publisher_item_count'];
$groupedResult[$uniqueKey]->publisher_total_cost += $row['total_cost'];
// Add the book-specific information to the books array
$groupedResult[$uniqueKey]->books[] = (object)[
'book_name' => $row['book_name'],
'item_count' => $row['item_count'],
'total_cost' => $row['total_cost'],
'invoice_date' => $row['invoice_date'],
];
}
return array_values($groupedResult);
}
public function updateInvoiceStatus($invoiceId, $voidReason)
{
// Assuming 'invoices' is the name of your table

0
app/Models/NotificationModel.php Normal file → Executable file
View File

0
app/Models/SchemeModel.php Normal file → Executable file
View File

0
app/Models/SettingsModel.php Normal file → Executable file
View File

12
app/Models/SubscriptionModel.php Normal file → Executable file
View File

@ -338,7 +338,17 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
$query = $builder->get();
return $query->getResult();
}
public function get_subscription_details_by_customerID($customerID)
{
$builder = $this->db->table('subscription');
$builder->select('subscription.from_subscription, subscription.to_subscription, subscription.scheme_id,books.price ,books.short_code');
$builder->join('books', 'subscription.scheme_id = books.book_id', 'left');
$builder->where('subscription.customer_id', $customerID);
$result = $builder->get()->getRowArray();
return $result;
}

0
app/Models/UsersModel.php Normal file → Executable file
View File

0
app/ThirdParty/.gitkeep vendored Normal file → Executable file
View File

0
app/Views/address_list.php Normal file → Executable file
View File

0
app/Views/address_pdf_landscape_template.php Normal file → Executable file
View File

0
app/Views/address_pdf_template.php Normal file → Executable file
View File

0
app/Views/approve_template.php Normal file → Executable file
View File

0
app/Views/auth_confirm_mail.php Normal file → Executable file
View File

0
app/Views/auth_lock_screen.php Normal file → Executable file
View File

0
app/Views/auth_reset_password.php Normal file → Executable file
View File

0
app/Views/book_form.php Normal file → Executable file
View File

0
app/Views/book_list.php Normal file → Executable file
View File

0
app/Views/business_form.php Normal file → Executable file
View File

0
app/Views/business_list.php Normal file → Executable file
View File

0
app/Views/campaign_creation.php Normal file → Executable file
View File

0
app/Views/campaign_creation_form.php Normal file → Executable file
View File

0
app/Views/customer_form.php Normal file → Executable file
View File

0
app/Views/customer_group.php Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More