gwm
This commit is contained in:
parent
69645b2b6d
commit
3854e3fca0
@ -144,67 +144,33 @@ class PaymentController extends BaseController
|
|||||||
{
|
{
|
||||||
|
|
||||||
// if(!session()->has('logged_user'))
|
// if(!session()->has('logged_user'))
|
||||||
|
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// return redirect()->to(base_url());
|
// return redirect()->to(base_url());
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$CartData = $this->cartModel->where('member_id',session()->get('logged_user'))->findAll();
|
$CartData = $this->cartModel->where('member_id',session()->get('logged_user'))->findAll();
|
||||||
|
|
||||||
$count = count($CartData);
|
$count = count($CartData);
|
||||||
|
|
||||||
if($count)
|
if($count)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$credit_pack_expiry_duration = $this->RuleModel->select('value')->where('rule_key', 1 )->get()->getRow()->value;
|
$credit_pack_expiry_duration = $this->RuleModel->select('value')->where('rule_key', 1 )->get()->getRow()->value;
|
||||||
|
|
||||||
$gst = $this->RuleModel->select('value')->where('rule_key', 3 )->get()->getRow()->value;
|
$gst = $this->RuleModel->select('value')->where('rule_key', 3 )->get()->getRow()->value;
|
||||||
|
|
||||||
$pst = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value;
|
$pst = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value;
|
||||||
|
|
||||||
$today = date("Y-m-d");
|
$today = date("Y-m-d");
|
||||||
|
|
||||||
$days = "+".$credit_pack_expiry_duration." days";
|
$days = "+".$credit_pack_expiry_duration." days";
|
||||||
|
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
|
|
||||||
$item_count = 0;
|
$item_count = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($CartData[0]['order_id'] == null)
|
if($CartData[0]['order_id'] == null)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$orderId = 'EGF'.rand(10,100).rand(10,100).rand(10,100);
|
$orderId = 'EGF'.rand(10,100).rand(10,100).rand(10,100);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$orderId = $CartData[0]['order_id'];
|
$orderId = $CartData[0]['order_id'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$packageArray = [];
|
$packageArray = [];
|
||||||
|
|
||||||
for($i=0;$i<$count;$i++)
|
for($i=0;$i<$count;$i++)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$packageData = $this->PackagesModel->where('id',$CartData[$i]['pack_id'])->find();
|
$packageData = $this->PackagesModel->where('id',$CartData[$i]['pack_id'])->find();
|
||||||
|
|
||||||
$packageData[0]['count'] = $CartData[$i]['count'];
|
$packageData[0]['count'] = $CartData[$i]['count'];
|
||||||
@ -214,130 +180,76 @@ class PaymentController extends BaseController
|
|||||||
$cost = $packageData[0]['cost'] * $CartData[$i]['count'];
|
$cost = $packageData[0]['cost'] * $CartData[$i]['count'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$credits_data['member_id'] = session()->get('logged_user');
|
$credits_data['member_id'] = session()->get('logged_user');
|
||||||
|
$credits_data['pack_id'] = $packageData[0]['id'];
|
||||||
$credits_data['package_name'] = $packageData[0]['package_name'];
|
$credits_data['package_name'] = $packageData[0]['package_name'];
|
||||||
|
|
||||||
$credits_data['package_type'] = $packageData[0]['package_type'];
|
$credits_data['package_type'] = $packageData[0]['package_type'];
|
||||||
|
|
||||||
$credits_data['credit_points'] = $packageData[0]['credit'];
|
$credits_data['credit_points'] = $packageData[0]['credit'];
|
||||||
|
|
||||||
$credits_data['running_balance'] = $packageData[0]['credit'];
|
$credits_data['running_balance'] = $packageData[0]['credit'];
|
||||||
|
|
||||||
$credits_data['expired_points'] = 0;
|
$credits_data['expired_points'] = 0;
|
||||||
|
|
||||||
$credits_data['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
|
$credits_data['expiring_date'] = date('Y-m-d', strtotime($days, strtotime($today)));
|
||||||
|
|
||||||
$credits_data['cost'] = $packageData[0]['cost'];
|
$credits_data['cost'] = $packageData[0]['cost'];
|
||||||
|
|
||||||
$credits_data['is_active'] = 0;
|
$credits_data['is_active'] = 0;
|
||||||
|
|
||||||
$credits_data['order_id'] = $orderId;
|
$credits_data['order_id'] = $orderId;
|
||||||
|
|
||||||
$credits_data['cost_with_tax'] = ( $packageData[0]['cost'] + (($packageData[0]['cost'] * ($gst + $pst) ) / 100) );
|
$credits_data['cost_with_tax'] = ( $packageData[0]['cost'] + (($packageData[0]['cost'] * ($gst + $pst) ) / 100) );
|
||||||
|
|
||||||
|
|
||||||
|
$creditsModel_pack_count = $this->creditsModel->selectCount('id')->where('pack_id',$packageData[0]['id'])->where('order_id',$orderId)->where('member_id', session()->get('logged_user'))->get()->getRow()->id;
|
||||||
$creditsModel_pack_count = $this->creditsModel->selectCount('id')->where('package_name',$packageData[0]['package_name'])->where('order_id',$orderId)->where('member_id', session()->get('logged_user'))->get()->getRow()->id;
|
if($creditsModel_pack_count)
|
||||||
|
{
|
||||||
|
$this->creditsModel->where('pack_id',$packageData[0]['id'])->where('order_id',$orderId)->where('member_id', session()->get('logged_user'))
|
||||||
|
->set(array('cost'=>$packageData[0]['cost'],'cost_with_tax'=>( $packageData[0]['cost'] + (($packageData[0]['cost'] * ($gst + $pst) ) / 100) ),'credit_points'=>$packageData[0]['credit'],'running_balance'=>$packageData[0]['credit'],'package_name'=>$packageData[0]['package_name'],'package_type'=>$packageData[0]['package_type']))->update();
|
||||||
|
}
|
||||||
$single_pack_no_of_count = $CartData[$i]['count'] - $creditsModel_pack_count;
|
$single_pack_no_of_count = $CartData[$i]['count'] - $creditsModel_pack_count;
|
||||||
|
|
||||||
// if($CartData[0]['order_id'] == null)
|
// if($CartData[0]['order_id'] == null)
|
||||||
|
|
||||||
// {
|
// {
|
||||||
|
|
||||||
for($j=0;$j<$single_pack_no_of_count;$j++)
|
for($j=0;$j<$single_pack_no_of_count;$j++)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$insert_data = $this->creditsModel->save($credits_data);
|
$insert_data = $this->creditsModel->save($credits_data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->cartModel->where('id', $CartData[$i]['id'] )
|
$this->cartModel->where('id', $CartData[$i]['id'] )
|
||||||
|
|
||||||
->where('member_id', session()->get('logged_user'))
|
->where('member_id', session()->get('logged_user'))
|
||||||
|
|
||||||
->set(array( 'order_id' => $orderId ))->update();
|
->set(array( 'order_id' => $orderId ))->update();
|
||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$amount = $amount + $cost;
|
$amount = $amount + $cost;
|
||||||
|
|
||||||
$item_count = $item_count + $CartData[$i]['count'];
|
$item_count = $item_count + $CartData[$i]['count'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$data['amount'] = $amount;
|
$data['amount'] = $amount;
|
||||||
|
|
||||||
$data['item_count'] = $item_count;
|
$data['item_count'] = $item_count;
|
||||||
|
|
||||||
$data['order_id'] = $orderId;
|
$data['order_id'] = $orderId;
|
||||||
|
|
||||||
$data['gst'] = $gst;
|
$data['gst'] = $gst;
|
||||||
|
|
||||||
$data['pst'] = $pst;
|
$data['pst'] = $pst;
|
||||||
|
|
||||||
$data['packageArray'] = $packageArray;
|
$data['packageArray'] = $packageArray;
|
||||||
|
|
||||||
$data['country'] = $this->CountryModel->findAll();
|
$data['country'] = $this->CountryModel->findAll();
|
||||||
|
|
||||||
$data['userdata'] = $this->MemberModel->where('id', session()->get('logged_user'))->find();
|
$data['userdata'] = $this->MemberModel->where('id', session()->get('logged_user'))->find();
|
||||||
|
|
||||||
|
|
||||||
$if_trans_exist = $this->TransactionModel->where('member_id', session()->get('logged_user'))
|
$if_trans_exist = $this->TransactionModel->where('member_id', session()->get('logged_user'))
|
||||||
|
|
||||||
->where('order_id', $orderId )->find();
|
->where('order_id', $orderId )->find();
|
||||||
|
|
||||||
if($if_trans_exist){
|
if($if_trans_exist){
|
||||||
|
//skip insertion
|
||||||
//skip insertion
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
//Trancaction Table initial entry for this transaction
|
//Trancaction Table initial entry for this transaction
|
||||||
|
|
||||||
$TrancactionData['status'] = 'In-Progress';
|
$TrancactionData['status'] = 'In-Progress';
|
||||||
|
|
||||||
$TrancactionData['member_id'] = session()->get('logged_user');
|
$TrancactionData['member_id'] = session()->get('logged_user');
|
||||||
|
|
||||||
$TrancactionData['order_id'] = $orderId;
|
$TrancactionData['order_id'] = $orderId;
|
||||||
|
|
||||||
$insert = $this->TransactionModel->save($TrancactionData);
|
$insert = $this->TransactionModel->save($TrancactionData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$zip = $this->ZipcodeModel->findAll();
|
$zip = $this->ZipcodeModel->findAll();
|
||||||
|
|
||||||
$output = '<option value="">'.$data['userdata'][0]['pincode'].'</option>';
|
$output = '<option value="">'.$data['userdata'][0]['pincode'].'</option>';
|
||||||
|
|
||||||
foreach($zip as $row)
|
foreach($zip as $row)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
$output .= '<option value="'.$row['id'].'">'.$row['code'].'</option>';
|
$output .= '<option value="'.$row['id'].'">'.$row['code'].'</option>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['zipcode'] = $output;
|
$data['zipcode'] = $output;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo view('checkout',$data);
|
echo view('checkout',$data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else { return redirect()->to(base_url()."view/".md5(session()->get('logged_user'))); }
|
} else { return redirect()->to(base_url()."view/".md5(session()->get('logged_user'))); }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -320,6 +320,7 @@ class Sendmail_controller extends BaseController
|
|||||||
->selectSum('cost', 'costSum')
|
->selectSum('cost', 'costSum')
|
||||||
->selectCount('package_name', 'pack_count')
|
->selectCount('package_name', 'pack_count')
|
||||||
->groupBy('package_name')->findAll();
|
->groupBy('package_name')->findAll();
|
||||||
|
|
||||||
$Subtotal = 0;
|
$Subtotal = 0;
|
||||||
foreach ($memberCredits as $key => $ele) {
|
foreach ($memberCredits as $key => $ele) {
|
||||||
$Subtotal = $Subtotal + $ele['costSum'];
|
$Subtotal = $Subtotal + $ele['costSum'];
|
||||||
@ -333,6 +334,7 @@ class Sendmail_controller extends BaseController
|
|||||||
$data['pst'] = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value;
|
$data['pst'] = $this->RuleModel->select('value')->where('rule_key', 4 )->get()->getRow()->value;
|
||||||
$data['card_brand'] = json_decode($data['TransactionData'][0]['transaction'] , true)['payment']['card_details']['card']['card_brand'];
|
$data['card_brand'] = json_decode($data['TransactionData'][0]['transaction'] , true)['payment']['card_details']['card']['card_brand'];
|
||||||
$data['last_4'] = json_decode($data['TransactionData'][0]['transaction'] , true)['payment']['card_details']['card']['last_4'];
|
$data['last_4'] = json_decode($data['TransactionData'][0]['transaction'] , true)['payment']['card_details']['card']['last_4'];
|
||||||
|
$data['profile'] = $this->MemberModel->select()->where('id', session()->get('logged_user'))->find();
|
||||||
$data['html'] = view('success_mail',$data);
|
$data['html'] = view('success_mail',$data);
|
||||||
|
|
||||||
|
|
||||||
@ -396,6 +398,7 @@ class Sendmail_controller extends BaseController
|
|||||||
$data['order_id'] = $data['TransactionData'][0]['order_id'];
|
$data['order_id'] = $data['TransactionData'][0]['order_id'];
|
||||||
$timestamp = strtotime($data['TransactionData'][0]['created_at']);
|
$timestamp = strtotime($data['TransactionData'][0]['created_at']);
|
||||||
$data['formattedDate'] = date('l, F j, Y', $timestamp);
|
$data['formattedDate'] = date('l, F j, Y', $timestamp);
|
||||||
|
$data['profile'] = $this->MemberModel->select()->where('id', session()->get('logged_user'))->find();
|
||||||
$data['html'] = view('failed_mail',$data);
|
$data['html'] = view('failed_mail',$data);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class Member_credits_model extends Model
|
|||||||
protected $table = 'member_credits';
|
protected $table = 'member_credits';
|
||||||
protected $primaryKey = 'id';
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
protected $allowedFields = ['member_id','package_name','package_type','credit_points','running_balance','used_points', 'expired_points','expiring_date', 'cost' ,'is_active', 'order_id','transaction_id' ,'cost_with_tax'];
|
protected $allowedFields = ['member_id','pack_id','package_name','package_type','credit_points','running_balance','used_points', 'expired_points','expiring_date', 'cost' ,'is_active', 'order_id','transaction_id' ,'cost_with_tax'];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -31,8 +31,7 @@
|
|||||||
<!-- Details Table -->
|
<!-- Details Table -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0" cellspacing="0"
|
<table cellpadding="0" cellspacing="0" style="width: 100%; border: 2px solid #ededed">
|
||||||
style="width: 100%; border: 1px solid #ededed">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
@ -58,6 +57,14 @@
|
|||||||
style="padding: 10px; border-bottom: 1px solid #ededed; color: #455056;">
|
style="padding: 10px; border-bottom: 1px solid #ededed; color: #455056;">
|
||||||
<?= $detail; ?></td>
|
<?= $detail; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
style="padding: 10px; border-bottom: 1px solid #ededed; border-right: 1px solid #ededed; width: 35%; font-weight:500; color:rgba(0,0,0,.64)">
|
||||||
|
Transaction by :</td>
|
||||||
|
<td
|
||||||
|
style="padding: 10px; border-bottom: 1px solid #ededed; color: #455056;">
|
||||||
|
<?= $profile[0]['name']." ".$profile[0]['last_name']." (".$profile[0]['mobile'].")"; ?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@ -33,8 +33,7 @@
|
|||||||
<!-- Details Table -->
|
<!-- Details Table -->
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0" cellspacing="0"
|
<table cellpadding="0" cellspacing="0" style="width: 100%; border: 2px solid #ededed">
|
||||||
style="width: 100%; border: 1px solid #ededed">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td
|
<td
|
||||||
@ -60,6 +59,14 @@
|
|||||||
style="padding: 10px; border-bottom: 1px solid #ededed; color: #455056;">
|
style="padding: 10px; border-bottom: 1px solid #ededed; color: #455056;">
|
||||||
<?= $card_brand; ?> card ending with <?= $last_4; ?></td>
|
<?= $card_brand; ?> card ending with <?= $last_4; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
style="padding: 10px; border-bottom: 1px solid #ededed; border-right: 1px solid #ededed; width: 35%; font-weight:500; color:rgba(0,0,0,.64)">
|
||||||
|
Transaction by :</td>
|
||||||
|
<td
|
||||||
|
style="padding: 10px; border-bottom: 1px solid #ededed; color: #455056;">
|
||||||
|
<?= $profile[0]['name']." ".$profile[0]['last_name']." (".$profile[0]['mobile'].")"; ?>
|
||||||
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user