Browse Source

CBB 1Gbps Promotion - Portal

hajar
Siti Hajar Ibrahim 5 years ago
parent
commit
af4fa5e0a7

+ 183
- 160
app/Http/Controllers/Form/BusinessController.php View File

<?php <?php

namespace App\Http\Controllers\Form; namespace App\Http\Controllers\Form;


use Illuminate\Http\Request; use Illuminate\Http\Request;


class BusinessController extends Controller class BusinessController extends Controller
{ {
public function successSubmit(){
public function successSubmit()
{
return view('sales.form.after_submit_form'); return view('sales.form.after_submit_form');
} }


public function successVerified(){
public function successVerified()
{
return view('sales.form.success_verify'); return view('sales.form.success_verify');
} }


public function sendInvoice($subscriber_id) {
public function sendInvoice($subscriber_id)
{


$subscriber = Subscriber::with('Form')->where('subscriber_id',$subscriber_id)->first();
$form = Form::with('Subscriber','PackageDetail')->where('_id',$subscriber->_id)->first();
$product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();
$subscriber = Subscriber::with('Form')->where('subscriber_id', $subscriber_id)->first();
$form = Form::with('Subscriber', 'PackageDetail')->where('_id', $subscriber->_id)->first();
$product = Product::where('speed', $form->PackageDetail->name)->where('formT', $form->type_application)->first();
SendCustomerInvoiceB::dispatch($form, $product, $form->Subscriber->email); SendCustomerInvoiceB::dispatch($form, $product, $form->Subscriber->email);


return $form->_id; return $form->_id;
} }


function random_code($limit) {
function random_code($limit)
{
return substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, $limit); return substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, $limit);
} }




public function viewFormAddress($package) {
public function viewFormAddress($package)
{


$dealer_id = ''; $dealer_id = '';
$coverage = Coverage::where('Type','B')->groupBy('building_name')->orderBy('building_name')->get();
$coverage = Coverage::where('Type', 'B')->groupBy('building_name')->orderBy('building_name')->get();
// dd($coverage); // dd($coverage);
return view('sales.form.business_address', compact('coverage','package','dealer_id'));
return view('sales.form.business_address', compact('coverage', 'package', 'dealer_id'));
} }


public function viewFormApplication(Request $request) {
public function viewFormApplication(Request $request)
{
$data = array(); $data = array();


$coverage = Coverage::where('building_name', $request->coverage)->where('street',$request->street)->get();
$coverage = Coverage::where('building_name', $request->coverage)->where('street', $request->street)->get();


array_push($data, array( array_push($data, array(
'coverage' => $coverage[0]['_id'], 'coverage' => $coverage[0]['_id'],
} }


public function viewFormPackage(Request $request) public function viewFormPackage(Request $request)
{
{
$data = array(); $data = array();
array_push($data, array( array_push($data, array(
'coverage' => $request->coverage, 'coverage' => $request->coverage,


$pg = $request->package; $pg = $request->package;


return view('sales.form.business_package', compact('data','pg'));
$coverage = Coverage::where('_id', $request->coverage)->first();
$city = $coverage->city;

return view('sales.form.business_package', compact('data', 'pg', 'city'));
} }


public function viewFormPreview(Request $request){
public function viewFormPreview(Request $request)
{


$data = array(); $data = array();


$coverage = Coverage::where('_id',$request->coverage)->first();
$product = Product::where('formT','B')->where('package_name',$request->package)->first();
$coverage = Coverage::where('_id', $request->coverage)->first();
$product = Product::where('formT', 'B')->where('package_name', $request->package)->first();
$otc = 0.0; $otc = 0.0;


$total_monthly = 0;
$gst ='';
$total_monthly = 0;
$gst = '';
$promo_st = ''; $promo_st = '';


$voice = "No"; $voice = "No";
if($request->voice == "Yes"){
if ($request->voice == "Yes") {
$voice = $request->voice; $voice = $request->voice;
$voice_price = 20; $voice_price = 20;
}else {
} else {
$voice = "No"; $voice = "No";
$voice_price = 0; $voice_price = 0;
} }


$ip_fee = 0; $ip_tax = 0;
$ip_fee = 0;
$ip_tax = 0;
if ($request->ip == "1 Fixed IP RM200/1P/Month") { if ($request->ip == "1 Fixed IP RM200/1P/Month") {
$ip_fee = 200 ;
$ip_tax = number_format((floatval($ip_fee) * 1.06),2);
}elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$ip_fee = 200;
$ip_tax = number_format((floatval($ip_fee) * 1.06), 2);
} elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$ip_fee = 400; $ip_fee = 400;
$ip_tax = number_format((floatval($ip_fee) * 1.06),2);
$ip_tax = number_format((floatval($ip_fee) * 1.06), 2);
} }


if ($request->package != "1Gbps" && $request->subscription == '24'){
if ($request->package != "1Gbps" && $request->subscription == '24') {
$promo_price = number_format(floatval($product->retail_price) - 10); $promo_price = number_format(floatval($product->retail_price) - 10);
$promo_st = number_format(floatval($promo_price) * 1.06,2);
$promo_st = number_format(floatval($promo_price) * 1.06, 2);
$total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2); $total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2);
}
else if ($request->package == "1Gbps"){
if ($request->ip == "1 Fixed IP RM200/1P/Month") {
$gst = number_format(floatval($product->retail_price) * 1.06,2);
$total_monthly = 3920.94;
}elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$gst = number_format(floatval($product->retail_price) * 1.06,2);
$total_monthly = 4132.94;
}else{
} else if ($request->package == "1Gbps") {
if ($request->subscription == '24' && $coverage->city == 'CYBERJAYA') {
$gst = 1058.94;
$total_monthly = 1058.94;
} else {
$gst = 3708.94; $gst = 3708.94;
$total_monthly = 3708.94; $total_monthly = 3708.94;
} }
}else{
$gst = number_format(floatval($product->retail_price) * 1.06,2);
} else {
$gst = number_format(floatval($product->retail_price) * 1.06, 2);
$total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2); $total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2);
} }


if($request->subscription == '12' && $voice == 'No'){
if ($request->package != '50Mbps'){

if ($request->subscription == '12' && $voice == 'No') {
if ($request->package != '50Mbps') {
$otc = 400; $otc = 400;
}else {
} else {
$otc = 300; $otc = 300;
} }
$deposit = $product->deposit; $deposit = $product->deposit;
}else if( $request->subscription == '12' && $voice == 'Yes'){
} else if ($request->subscription == '12' && $voice == 'Yes') {
$otc = 300 + 100; $otc = 300 + 100;
$deposit = $product->deposit; $deposit = $product->deposit;
}else {
} else {
$otc = 0.0; $otc = 0.0;
$deposit = $product->deposit; $deposit = $product->deposit;
} }


$otc_st = number_format(floatval($otc) * 1.06,2);
$upfront_total = number_format(floatval($otc_st) + $deposit,2);
$otc_st = number_format(floatval($otc) * 1.06, 2);
$upfront_total = number_format(floatval($otc_st) + $deposit, 2);


$total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2); $total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2);


return view('sales.form.business_preview', compact('data', 'coverage', 'product', 'deposit', 'otc', 'otc_st', 'gst', 'promo_price', 'promo_st', 'total_monthly', 'upfront_total')); return view('sales.form.business_preview', compact('data', 'coverage', 'product', 'deposit', 'otc', 'otc_st', 'gst', 'promo_price', 'promo_st', 'total_monthly', 'upfront_total'));
} }


public function storeFormData(Request $request){
public function storeFormData(Request $request)
{


$su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathForm9 = '';
$su_id = '';
$pathIconF = '';
$pathIconB = '';
$pathForm9 = '';


do { do {
$su_id = strtoupper('CBB-'.$this->random_code(6).'B');
$su_id = strtoupper('CBB-' . $this->random_code(6) . 'B');
} while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber); } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);


$destinationPath = 'document/'.$su_id;
$destinationPath = 'document/' . $su_id;
// create folder/dir if not exist // create folder/dir if not exist


if(!File::exists(public_path().'/'.$destinationPath)){
File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
if (!File::exists(public_path() . '/' . $destinationPath)) {
File::makeDirectory(public_path() . '/' . $destinationPath, 0777, true);
} }


if($request->hasfile('front_ic')){
if ($request->hasfile('front_ic')) {


$icon = $request->file('front_ic'); $icon = $request->file('front_ic');
$icon->move($destinationPath,'frontic.'.$icon->getClientOriginalExtension());
$pathIconF = '/'.$destinationPath.'/frontic.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'frontic.' . $icon->getClientOriginalExtension());
$pathIconF = '/' . $destinationPath . '/frontic.' . $icon->getClientOriginalExtension();
} }


if($request->hasfile('back_ic')){
if ($request->hasfile('back_ic')) {


$icon = $request->file('back_ic'); $icon = $request->file('back_ic');
$icon->move($destinationPath,'backic.'.$icon->getClientOriginalExtension());
$pathIconB = '/'.$destinationPath.'/backic.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'backic.' . $icon->getClientOriginalExtension());
$pathIconB = '/' . $destinationPath . '/backic.' . $icon->getClientOriginalExtension();
} }


if($request->hasfile('form9')){
if ($request->hasfile('form9')) {


$icon = $request->file('form9'); $icon = $request->file('form9');
$icon->move($destinationPath,'formD.'.$icon->getClientOriginalExtension());
$pathForm9 = '/'.$destinationPath.'/formD.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'formD.' . $icon->getClientOriginalExtension());
$pathForm9 = '/' . $destinationPath . '/formD.' . $icon->getClientOriginalExtension();
} }


if($pathForm9 != '' && $pathIconB != '' && $pathIconF != ''){
if ($pathForm9 != '' && $pathIconB != '' && $pathIconF != '') {


$coverage = Coverage::where('_id',$request->coverage)->first();
$product = Product::where('formT','B')->where('package_name',$request->package)->first();
$coverage = Coverage::where('_id', $request->coverage)->first();
$product = Product::where('formT', 'B')->where('package_name', $request->package)->first();


$sl = Form::create([ $sl = Form::create([
'type_service' => $request->application, 'type_service' => $request->application,
$sdl->front_ic = $pathIconF; $sdl->front_ic = $pathIconF;
$sdl->back_ic = $pathIconB; $sdl->back_ic = $pathIconB;
$sdl->form9_44 = $pathForm9; $sdl->form9_44 = $pathForm9;
$packageD = new PackageDetail(); $packageD = new PackageDetail();
$packageD->contract = $request->subscription; $packageD->contract = $request->subscription;
$packageD->name = $product->speed; $packageD->name = $product->speed;
if ($request->gst != null){
if ($request->gst != null) {
$packageD->montly_fee = $request->gst; $packageD->montly_fee = $request->gst;
}else {
} else {
$packageD->montly_fee = $request->promo_st; $packageD->montly_fee = $request->promo_st;
} }
$packageD->voice_fee = $request->voice; $packageD->voice_fee = $request->voice;
$stat = new FormStatus(); $stat = new FormStatus();
$stat->form_id = $f_id; $stat->form_id = $f_id;
$stat->status_id = 1; $stat->status_id = 1;
$stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
$stat->date = new \MongoDB\BSON\UTCDateTime(time() * 1000);
$stat->status = 'Submitted'; $stat->status = 'Submitted';
$stat->desc = 'The form already been submit'; $stat->desc = 'The form already been submit';
$sl->formstatus()->save($stat); $sl->formstatus()->save($stat);
} }


/*** /***
** Dealer
***/
** Dealer
***/


public function viewFormAddressD($package,$dealer_id) {
$coverage = Coverage::where('Type','B')->groupBy('building_name')->orderBy('building_name')->get();
return view('sales.form.dealer.business_address', compact('coverage','package','dealer_id'));
public function viewFormAddressD($package, $dealer_id)
{
$coverage = Coverage::where('Type', 'B')->groupBy('building_name')->orderBy('building_name')->get();
return view('sales.form.dealer.business_address', compact('coverage', 'package', 'dealer_id'));
} }


public function viewFormApplicationD(Request $request) {
public function viewFormApplicationD(Request $request)
{
$data = array(); $data = array();


$coverage = Coverage::where('building_name', $request->coverage)->where('street',$request->street)->get();
$coverage = Coverage::where('building_name', $request->coverage)->where('street', $request->street)->get();


array_push($data, array( array_push($data, array(
'coverage' => $coverage[0]['_id'], 'coverage' => $coverage[0]['_id'],
} }


public function viewFormPackageD(Request $request) public function viewFormPackageD(Request $request)
{
{
$data = array(); $data = array();
array_push($data, array( array_push($data, array(
'coverage' => $request->coverage, 'coverage' => $request->coverage,


$pg = $request->package; $pg = $request->package;


return view('sales.form.dealer.business_package', compact('data','pg'));
return view('sales.form.dealer.business_package', compact('data', 'pg'));
} }


public function viewFormPreviewD(Request $request){
public function viewFormPreviewD(Request $request)
{
$data = array(); $data = array();


$coverage = Coverage::where('_id',$request->coverage)->first();
$product = Product::where('formT','B')->where('package_name',$request->package)->first();
$coverage = Coverage::where('_id', $request->coverage)->first();
$product = Product::where('formT', 'B')->where('package_name', $request->package)->first();
$otc = 0.0; $otc = 0.0;


$total_monthly = 0;
$gst ='';
$total_monthly = 0;
$gst = '';
$promo_st = ''; $promo_st = '';


$voice = "No"; $voice = "No";
if($request->voice == "Yes"){
if ($request->voice == "Yes") {
$voice = $request->voice; $voice = $request->voice;
$voice_price = 20; $voice_price = 20;
}else {
} else {
$voice = "No"; $voice = "No";
$voice_price = 0; $voice_price = 0;
} }
$ip_fee = 0; $ip_tax = 0;

$ip_fee = 0;
$ip_tax = 0;
if ($request->ip == "1 Fixed IP RM200/1P/Month") { if ($request->ip == "1 Fixed IP RM200/1P/Month") {
$ip_fee = 200 ;
$ip_tax = number_format((floatval($ip_fee) * 1.06),2);
}elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$ip_fee = 200;
$ip_tax = number_format((floatval($ip_fee) * 1.06), 2);
} elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$ip_fee = 400; $ip_fee = 400;
$ip_tax = number_format((floatval($ip_fee) * 1.06),2);
$ip_tax = number_format((floatval($ip_fee) * 1.06), 2);
} }


if ($request->package != "1Gbps" && $request->subscription == '24'){
if ($request->package != "1Gbps" && $request->subscription == '24') {
$promo_price = number_format(floatval($product->retail_price) - 10); $promo_price = number_format(floatval($product->retail_price) - 10);
$promo_st = number_format(floatval($promo_price) * 1.06,2);
$promo_st = number_format(floatval($promo_price) * 1.06, 2);
$total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2); $total_monthly = number_format($promo_st + ($voice_price * 1.06) + $ip_tax, 2);
}
else if ($request->package == "1Gbps"){
} else if ($request->package == "1Gbps") {
if ($request->ip == "1 Fixed IP RM200/1P/Month") { if ($request->ip == "1 Fixed IP RM200/1P/Month") {
$gst = number_format(floatval($product->retail_price) * 1.06,2);
$gst = number_format(floatval($product->retail_price) * 1.06, 2);
$total_monthly = 3920.94; $total_monthly = 3920.94;
}elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$gst = number_format(floatval($product->retail_price) * 1.06,2);
} elseif ($request->ip == "5 Fixed IP RM400/1P/Month") {
$gst = number_format(floatval($product->retail_price) * 1.06, 2);
$total_monthly = 4132.94; $total_monthly = 4132.94;
}else{
} else {
$gst = 3708.94; $gst = 3708.94;
$total_monthly = 3708.94; $total_monthly = 3708.94;
} }
}
else{
$gst = number_format(floatval($product->retail_price) * 1.06,2);
} else {
$gst = number_format(floatval($product->retail_price) * 1.06, 2);
$total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2); $total_monthly = number_format($gst + ($voice_price * 1.06) + $ip_tax, 2);
} }


if($request->subscription == '12' && $voice == 'No'){
if ($request->package != '50Mbps'){

if ($request->subscription == '12' && $voice == 'No') {
if ($request->package != '50Mbps') {
$otc = 400; $otc = 400;
}else {
} else {
$otc = 300; $otc = 300;
} }
$deposit = $product->deposit; $deposit = $product->deposit;
}else if( $request->subscription == '12' && $voice == 'Yes'){
} else if ($request->subscription == '12' && $voice == 'Yes') {
$otc = 300 + 100; $otc = 300 + 100;
$deposit = $product->deposit; $deposit = $product->deposit;
}else if($request->subscription == '12' && $request->package != '50Mbps'){
} else if ($request->subscription == '12' && $request->package != '50Mbps') {
$otc = 400; $otc = 400;
$deposit = $product->deposit; $deposit = $product->deposit;
}else {
} else {
$otc = 0.0; $otc = 0.0;
$deposit = $product->deposit; $deposit = $product->deposit;
} }


$otc_st = number_format(floatval($otc) * 1.06,2);
$upfront_total = number_format(floatval($otc_st) + $deposit,2);
$otc_st = number_format(floatval($otc) * 1.06, 2);
$upfront_total = number_format(floatval($otc_st) + $deposit, 2);


$total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2); $total = number_format((floatval($product->retail_price) * 1.06) + ($otc * 1.06) + $deposit + $ip_tax, 2);


return view('sales.form.dealer.business_preview', compact('data', 'coverage', 'product', 'deposit', 'otc', 'otc_st', 'gst', 'promo_price', 'promo_st', 'total_monthly', 'upfront_total')); return view('sales.form.dealer.business_preview', compact('data', 'coverage', 'product', 'deposit', 'otc', 'otc_st', 'gst', 'promo_price', 'promo_st', 'total_monthly', 'upfront_total'));
} }


public function storeFormDataD(Request $request){
public function storeFormDataD(Request $request)
{


$su_id = ''; $pathIconF = ''; $pathIconB = ''; $pathForm9 = ''; $pathPaymentReceipt = ''; $pathSoForm = '';
$su_id = '';
$pathIconF = '';
$pathIconB = '';
$pathForm9 = '';
$pathPaymentReceipt = '';
$pathSoForm = '';


do { do {
$su_id = strtoupper('CBB-'.$this->random_code(6).'B');
$su_id = strtoupper('CBB-' . $this->random_code(6) . 'B');
} while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber); } while (Subscriber::where("subscriber_id", "=", $su_id)->first() instanceof Subscriber);


$destinationPath = 'document/'.$su_id;
$destinationPath = 'document/' . $su_id;
// create folder/dir if not exist // create folder/dir if not exist
if(!File::exists(public_path().'/'.$destinationPath)){
File::makeDirectory(public_path().'/'.$destinationPath,0777,true);
if (!File::exists(public_path() . '/' . $destinationPath)) {
File::makeDirectory(public_path() . '/' . $destinationPath, 0777, true);
} }




if($request->hasfile('front_ic')){
if ($request->hasfile('front_ic')) {


$icon = $request->file('front_ic'); $icon = $request->file('front_ic');
$icon->move($destinationPath,'frontic.'.$icon->getClientOriginalExtension());
$pathIconF = '/'.$destinationPath.'/frontic.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'frontic.' . $icon->getClientOriginalExtension());
$pathIconF = '/' . $destinationPath . '/frontic.' . $icon->getClientOriginalExtension();
} }


if($request->hasfile('back_ic')){
if ($request->hasfile('back_ic')) {


$icon = $request->file('back_ic'); $icon = $request->file('back_ic');
$icon->move($destinationPath,'backic.'.$icon->getClientOriginalExtension());
$pathIconB = '/'.$destinationPath.'/backic.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'backic.' . $icon->getClientOriginalExtension());
$pathIconB = '/' . $destinationPath . '/backic.' . $icon->getClientOriginalExtension();
} }


if($request->hasfile('form9')){
if ($request->hasfile('form9')) {


$icon = $request->file('form9'); $icon = $request->file('form9');
$icon->move($destinationPath,'formD.'.$icon->getClientOriginalExtension());
$pathForm9 = '/'.$destinationPath.'/formD.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'formD.' . $icon->getClientOriginalExtension());
$pathForm9 = '/' . $destinationPath . '/formD.' . $icon->getClientOriginalExtension();
} }


if($request->hasfile('paymentReceipt')){
if ($request->hasfile('paymentReceipt')) {


$icon = $request->file('paymentReceipt'); $icon = $request->file('paymentReceipt');
$icon->move($destinationPath,'paymentReceipt.'.$icon->getClientOriginalExtension());
$pathPaymentReceipt = '/'.$destinationPath.'/paymentReceipt.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'paymentReceipt.' . $icon->getClientOriginalExtension());
$pathPaymentReceipt = '/' . $destinationPath . '/paymentReceipt.' . $icon->getClientOriginalExtension();
} }


if($request->hasfile('soForm')){
if ($request->hasfile('soForm')) {


$icon = $request->file('soForm'); $icon = $request->file('soForm');
$icon->move($destinationPath,'soForm.'.$icon->getClientOriginalExtension());
$pathSoForm = '/'.$destinationPath.'/soForm.'.$icon->getClientOriginalExtension();
$icon->move($destinationPath, 'soForm.' . $icon->getClientOriginalExtension());
$pathSoForm = '/' . $destinationPath . '/soForm.' . $icon->getClientOriginalExtension();
} }


if($pathForm9 != '' && $pathIconB != '' && $pathIconF != ''){
if ($pathForm9 != '' && $pathIconB != '' && $pathIconF != '') {


$staff = Staff::with('StaffDetail')->where('_id',$request->dealer_id)->first();
if(!empty($staff)){
$coverage = Coverage::where('_id',$request->coverage)->first();
$product = Product::where('formT','B')->where('package_name',$request->package)->first();
$staff = Staff::with('StaffDetail')->where('_id', $request->dealer_id)->first();
if (!empty($staff)) {
$coverage = Coverage::where('_id', $request->coverage)->first();
$product = Product::where('formT', 'B')->where('package_name', $request->package)->first();


$sl = new Form(); $sl = new Form();
$sl->type_service = $request->application; $sl->type_service = $request->application;
$sl->remark_form = ''; $sl->remark_form = '';
$sl->dealer_id = $request->dealer_id; $sl->dealer_id = $request->dealer_id;
$sl->company_id = $staff->StaffDetail->company_id; $sl->company_id = $staff->StaffDetail->company_id;
$staff->form()->save($sl); $staff->form()->save($sl);


$sdl = new Subscriber(); $sdl = new Subscriber();
$sdl->state = $coverage->state; $sdl->state = $coverage->state;
$sdl->front_ic = $pathIconF; $sdl->front_ic = $pathIconF;
$sdl->back_ic = $pathIconB; $sdl->back_ic = $pathIconB;
$sdl->form9_44 = $pathForm9;
$sdl->form9_44 = $pathForm9;
$sdl->paymentReceipt = $pathPaymentReceipt; $sdl->paymentReceipt = $pathPaymentReceipt;
$sdl->soForm = $pathSoForm; $sdl->soForm = $pathSoForm;
$packageD = new PackageDetail(); $packageD = new PackageDetail();
$packageD->contract = $request->subscription; $packageD->contract = $request->subscription;
$packageD->name = $product->speed; $packageD->name = $product->speed;
if ($request->gst != null){
if ($request->gst != null) {
$packageD->montly_fee = $request->gst; $packageD->montly_fee = $request->gst;
}else {
} else {
$packageD->montly_fee = $request->promo_st; $packageD->montly_fee = $request->promo_st;
} }
$packageD->voice_fee = $request->voice; $packageD->voice_fee = $request->voice;
$stat = new FormStatus(); $stat = new FormStatus();
$stat->form_id = $f_id; $stat->form_id = $f_id;
$stat->status_id = 1; $stat->status_id = 1;
$stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
$stat->date = new \MongoDB\BSON\UTCDateTime(time() * 1000);
$stat->status = 'Submitted'; $stat->status = 'Submitted';
$stat->desc = 'The form already been submit'; $stat->desc = 'The form already been submit';
$sl->formstatus()->save($stat); $sl->formstatus()->save($stat);
} }
} }


public function verifyEmail($subscriber_id){
$subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
if(!empty($subscriber)){
$form = Form::where('_id',$subscriber->_id)->first();
if(!empty($form)){
if($form->status_email == 'unverified'){
public function verifyEmail($subscriber_id)
{
$subscriber = Subscriber::where('subscriber_id', $subscriber_id)->first();
if (!empty($subscriber)) {
$form = Form::where('_id', $subscriber->_id)->first();
if (!empty($form)) {
if ($form->status_email == 'unverified') {
$form->status_email = 'verified'; $form->status_email = 'verified';
$form->save(); $form->save();


$stat = new FormStatus(); $stat = new FormStatus();
$stat->form_id = $form->_id; $stat->form_id = $form->_id;
$stat->status_id = 2; $stat->status_id = 2;
$stat->date = new \MongoDB\BSON\UTCDateTime(time()*1000);
$stat->date = new \MongoDB\BSON\UTCDateTime(time() * 1000);
$stat->status = 'Verified'; $stat->status = 'Verified';
$stat->desc = 'Email already been verified by customer'; $stat->desc = 'Email already been verified by customer';
$form->formstatus()->save($stat); $form->formstatus()->save($stat);
} }
} }


public function resendEmail($subscriber_id){
public function resendEmail($subscriber_id)
{
$f_id = $this->sendInvoice($subscriber_id); $f_id = $this->sendInvoice($subscriber_id);
return $f_id; return $f_id;
} }


public function checkEmailTemplate($subscriber_id){
$subscriber = Subscriber::where('subscriber_id',$subscriber_id)->first();
if(!empty($subscriber)){
$form = Form::where('_id',$subscriber->_id)->first();
$product = Product::where('speed',$form->PackageDetail->name)->where('formT',$form->type_application)->first();

public function checkEmailTemplate($subscriber_id)
{
$subscriber = Subscriber::where('subscriber_id', $subscriber_id)->first();
if (!empty($subscriber)) {
$form = Form::where('_id', $subscriber->_id)->first();
$product = Product::where('speed', $form->PackageDetail->name)->where('formT', $form->type_application)->first();
} }
return view('email.invoiceb', compact ('form', 'product'));
return view('email.invoiceb', compact('form', 'product'));
} }
} }

+ 13
- 3
resources/views/sales/form/business_package.blade.php View File

<label class="radio-inline"> <label class="radio-inline">
<input type="checkbox" id="10off" checked=""> <small id="10off1">Year End Promotion (RM10 off for 24 months)</small> <input type="checkbox" id="10off" checked=""> <small id="10off1">Year End Promotion (RM10 off for 24 months)</small>
</label> </label>
@elseif ($pg == "1Gbps" && $city == "CYBERJAYA")
<label class="radio-inline">
<input type="checkbox" id="10off" checked=""> <small id="10off1">City Broadband Business Cyberjaya 1Gbps@RM999 Promotion</small>
</label>
@endif @endif
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
@if ($pg == "1Gbps") @if ($pg == "1Gbps")
<label>
<input type="checkbox" name="ip" id="ip" value="Free 3 Fixed IP" checked> <p style="margin-bottom: 0px !important">Free 3 Fixed IP</p>
</label>
@if ($city == "CYBERJAYA")
<label>
<input type="checkbox" name="ip" id="ip" value="Free 1 Fixed IP" checked> <p style="margin-bottom: 0px !important">Free 1 Fixed IP</p>
</label>
@else
<label>
<input type="checkbox" name="ip" id="ip" value="Free 3 Fixed IP" checked> <p style="margin-bottom: 0px !important">Free 3 Fixed IP</p>
</label>
@endif
@else @else
<label> <label>
<p>Add on subscribtion for Fixed IP?</p> <p>Add on subscribtion for Fixed IP?</p>

+ 8
- 0
resources/views/sales/form/business_preview.blade.php View File

<td>Year End Promotion (RM10 off for 24 months)</td> <td>Year End Promotion (RM10 off for 24 months)</td>
</tr> </tr>
@endif @endif
@if ($a['subscription']==24 && $a['package'] == '1Gbps' && $coverage->city == 'CYBERJAYA')
<tr><th width="50%">Promotion</th>
<td>City Broadband Business Cyberjaya 1Gbps@RM999 Promotion</td>
</tr>
@endif
<tr><th width="50%">Contract Term</th> <tr><th width="50%">Contract Term</th>
<td>{{$a['subscription']}} Months</td> <td>{{$a['subscription']}} Months</td>
</tr> </tr>
@if($a['package']!='1Gbps' && $a['subscription']=='24') @if($a['package']!='1Gbps' && $a['subscription']=='24')
<td><span style="text-decoration: line-through;">RM{{ $product->retail_price }}</span> RM{{ $promo_price}}</td> <td><span style="text-decoration: line-through;">RM{{ $product->retail_price }}</span> RM{{ $promo_price}}</td>
<td>RM{{ $promo_st }}</td> <td>RM{{ $promo_st }}</td>
@elseif($a['package']=='1Gbps' && $a['subscription']=='24' && $coverage->city == 'CYBERJAYA')
<td><span style="text-decoration: line-through;">RM{{ $product->retail_price }}</span> RM999</td>
<td>RM{{ $gst }}</td>
@else @else
<td>RM{{ $product->retail_price }}</td> <td>RM{{ $product->retail_price }}</td>
<td>RM{{ $gst }}</td> <td>RM{{ $gst }}</td>

Loading…
Cancel
Save