Bug Fixes : ps
This commit is contained in:
parent
ecc21ba75e
commit
0b8144a952
@ -124,7 +124,6 @@ $routes->get("delete_invoice/(:any)", "Invoice::delete_invoice/$1");
|
||||
$routes->add('approve_invoice/(:num)', 'Invoice::approve_invoice/$1');
|
||||
$routes->get('generate_invoice_pdf/(:num)', 'Invoice::generate_invoice_pdf/$1');
|
||||
$routes->get('print_address/(:num)', 'Invoice::print_address/$1');
|
||||
$routes->get('print_address/(:num)', 'Invoice::print_address/$1');
|
||||
|
||||
$routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp');
|
||||
$routes->match(['get','post'],'/mem_inv_rp','Invoice::general_membership_inv_rp');
|
||||
@ -149,9 +148,10 @@ $routes->get('campaign_creation_form/(:any)', 'Notifications::campaign_creation_
|
||||
$routes->get('campaign_creation_delete/(:any)', 'Notifications::campaign_creation_delete/$1');
|
||||
$routes->post("campaign_creation_insert", "Notifications::campaign_creation_insert");
|
||||
|
||||
# Auto run process routes
|
||||
$routes->get('process_scheduled_notifications/', 'Notifications::processScheduledNotifications');
|
||||
$routes->get('acknowlegdement', 'Notifications::noifications_acknowlegdement');
|
||||
|
||||
$routes->get('subscription_inactive', 'Invoice::subscription_inactive');
|
||||
|
||||
# Api integration Routes
|
||||
$routes->post('api/(:any)', 'ApiIntegration::api_integration/$1');
|
||||
|
||||
@ -173,7 +173,31 @@ class Invoice extends BaseController
|
||||
$customer_id = (int)$this->request->getPost('customer_name');
|
||||
$invoiceType = $this->request->getPost('invoice_type');
|
||||
$msg_flag_name = ((int)$invoiceType === 1) ? "Invoice " : "Subscription ";
|
||||
$renewal = 0;
|
||||
if ((int)$invoiceType === 2 && $invoice_status == 'Approved') {
|
||||
$requestData = $this->request->getPost();
|
||||
$itemid = $requestData['invoice_child_id'];
|
||||
$count = count($itemid);
|
||||
$scheme_id = null;
|
||||
if ($count > 0) {
|
||||
for ($x = 0; $x < $count; $x++) {
|
||||
if (!empty($requestData['item_details'][$x])) {
|
||||
$scheme_id = (int)$requestData['item_details'][$x];
|
||||
}
|
||||
}
|
||||
}
|
||||
// $now = date('Y-m-d');
|
||||
// $get_exists_subscription_where = ['S.customer_id' => (int)$customer_id,'S.scheme_id' => $scheme_id,'I.status' => 'Approved','I.isactive' => 1,"S.to_subscription <= "=>$now];
|
||||
$get_exists_subscription_where = ['S.customer_id' => (int)$customer_id,'S.scheme_id' => $scheme_id,'I.status' => 'Approved','I.isactive' => 1];
|
||||
$get_exists_subscription_dtls = $model->existsSubscriptionDetails($get_exists_subscription_where);
|
||||
|
||||
if ($get_exists_subscription_dtls) {
|
||||
// session()->setFlashdata('success', 'This Scheme Already Existing in this Customer.');
|
||||
$this->logger->info($msg_flag_name . ": This Scheme Already Existing in this Customer. ");
|
||||
$renewal = 1;
|
||||
}
|
||||
}
|
||||
|
||||
## Array Formation For Invoice Details..
|
||||
$data = [
|
||||
'invoice_number' => $this->request->getPost('invoice_number'),
|
||||
@ -265,6 +289,7 @@ class Invoice extends BaseController
|
||||
'to_subscription'=> $to_sub_date,
|
||||
'business_id' => get_business_id(),
|
||||
'created_by' =>get_logged_user_id(),
|
||||
'is_renew' => $renewal
|
||||
];
|
||||
|
||||
$get_subscription_draft_dtl_where = ['S.customer_id'=>$customer_id,'I.status'=>$invoice_status];
|
||||
@ -453,6 +478,11 @@ class Invoice extends BaseController
|
||||
// Redirect back to the invoice list
|
||||
return redirect()->route('invoice_list');
|
||||
}
|
||||
public function subscription_inactive(){
|
||||
$model = new InvoiceModel();
|
||||
$details = $model->subscription_inactive();
|
||||
return $details;
|
||||
}
|
||||
|
||||
public function approve_notifications($invoice_id)
|
||||
{
|
||||
|
||||
@ -63,6 +63,16 @@ public function InactiveSubscriptionDraftDetails($where,$update_by_id)
|
||||
return $inactive_invoice_ids;
|
||||
}
|
||||
|
||||
## check the customer the scheme already Exist
|
||||
public function existsSubscriptionDetails($where){
|
||||
$result = $this->getJoinedData($where);
|
||||
if(count($result)>0){
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getSubscriptionInvoiceDetail($where)
|
||||
{
|
||||
$result = $this->getJoinedData($where);
|
||||
@ -105,6 +115,28 @@ public function InactiveSubscriptionDraftDetails($where,$update_by_id)
|
||||
// I.shipping_address_id, I.billing_address_id,
|
||||
}
|
||||
|
||||
## subscription_inactive
|
||||
public function subscription_inactive(){
|
||||
|
||||
$now = date('Y-m-d');
|
||||
|
||||
$result = $this->db->table('subscription as S')
|
||||
->select('S.sub_id, S.scheme_id, S.customer_id, S.business_id,S.invoice_id,S.mode,S.from_subscription, S.to_subscription, S.is_renew, S.isactive')
|
||||
->where("S.isactive",1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
if(!empty($result)){
|
||||
foreach ($result as $row) {
|
||||
$this->db->table('subscription')
|
||||
->set('isactive', 0)
|
||||
->where('to_subscription < ',$now)
|
||||
->update();
|
||||
}
|
||||
return "Updated";
|
||||
}else{
|
||||
return "No data";
|
||||
}
|
||||
}
|
||||
|
||||
public function getDetailForApproveNotifications($where)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user