public function postDealinsert(Request $request) { $rules = array('eventname' => 'required', 'company' => 'required', 'dealdate' => 'required', 'deal_value' => 'required', 'deal_curr' => 'required', 'sent_date' => 'required', 'rec_date' => 'required', 'deal_type' => 'required'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return redirect('targetmodule/eventdeal')->withErrors($validator); } else { $data = Input::get(); $dealstatus = '1'; $c = new Deal(); $c->Clientname = $data['clientname']; $c->Companyname = $data['company']; $c->Eventname = $data['eventname']; $c->Dealdate = $data['dealdate']; $c->Dealvalue = $data['deal_value']; $c->Dealtype = $data['deal_type']; $c->Dealcurr = $data['deal_curr']; $c->ConSentdate = $data['sent_date']; $c->ConRecdate = $data['rec_date']; $c->Empid = $data['emp_id']; $c->Status = $dealstatus; $c->save(); $request->session()->flash('alert-success', 'Deal Has Been inserted Successfully'); return redirect('targetmodule/eventdeal'); // } }
/** * Run the database seeds. * * @return void */ public function run() { $deals = [['name' => 'Desert Safari with Dinner', 'slug' => 'desert-safari-with-dinner', 'description' => '<p>The price for desert safari is 295 per person. We currently have a buy one get one free promotion if you have one of our promotional vouchers in the entertainer or gulf news.</p> <h3>Our Desert Safari with Dinner includes</h3> <ul> <li>Pickup from your hotel or residence in Dubai or Sharjah</li> <li>Dune Bashing (Adventurous Desert Drive)</li> <li>Henna Painting</li> <li>Arabic Dress Photograph opportunity</li> <li>Camel Ride</li> <li>Sand Boarding (Optional - upon availability)</li> <li>Quad Biking (Optional - upon availability with extra charge)</li> <li>BBQ Dinner (Vegetarian option available)</li> <li>Soft drinks, Mineral Water, Tea & Coffee (Unlimited)</li> <li>Sheesha / Hubbllee Bubblee smoking facility</li> <li>Belly Dance show</li> <li>Tanoura Dance Show</li> <li>Alcohol available at camp - at extracost</li> <li>Return back to your hotel or residence</li> </ul> ', 'photos' => [['path' => 'Desert-Safari-with-Dinner.jpg']]]]; foreach ($deals as $item) { $promo = new Deal(); $promo->name = $item['name']; $promo->slug = $item['slug']; $promo->description = $item['description']; $promo->save(); foreach ($item['photos'] as $photo) { $newPhoto = new Photo(['path' => $photo['path']]); $promo->photos()->save($newPhoto); } } }
/** * 退款 * * @param Deal $payDeal 支付交易 * * @return bool */ public static function refund(Deal $payDeal) { $state = RegistrationController::xxPay($payDeal->payee_account, $payDeal->payer_account, $payDeal->fee); //TODO 待优化 if ($state == 1) { $refundDeal = new Deal(); $refundDeal->registration_id = $payDeal->registration_id; $refundDeal->fee = $payDeal->fee; $refundDeal->payer_account = $payDeal->payee_account; $refundDeal->payee_account = $payDeal->payer_account; $refundDeal->type = '退款'; if ($refundDeal->save()) { return true; } } return false; }
public function postDelegatedealupload(Request $request) { $data = Input::get(); $eventcode = Input::get('eventname'); $result = explode('|', $eventcode, 2); $eventcode = trim($result[0]); $eventname = trim($result[1]); //emp id and name $eid = Input::get('emp_id'); $result = explode('|', $eid, 2); $emid = trim($result[0]); $ename = trim($result[1]); $leadid = Input::get('leadid'); $empdept = Input::get('empdept'); $dealstatus = '1'; $dealtype = 'single'; $c = new Deal(); if ($data['kindofsub'] == 'paid') { $delavalue = $data['deal_value']; $dealcurr = $data['deal_curr']; } if ($data['kindofsub'] == 'free') { $delavalue = '0'; $dealcurr = '0'; } $c->Companyname = $data['company']; $c->Eventcode = $eventcode; $c->Eventname = $eventname; $c->Dealdate = $data['dealdate']; $c->Dealvalue = $delavalue; $c->kindofsub = $data['kindofsub']; $c->Dealcurr = $dealcurr; $c->Empid = $emid; $c->Empname = $ename; $c->leadcode = $data['leadcode']; $c->Status = $dealstatus; $c->Dealtype = $dealstatus; $c->save(); $lastinsertid = $c->id; $updatedeal = new delegatedealinfo(); $updatedeal->deal_id = $lastinsertid; $updatedeal->leadcode = $data['leadcode']; $updatedeal->boq = '1'; $updatedeal->vip = 'NULL'; $updatedeal->hotel = 'NULL'; $updatedeal->logo = 'NULL'; $updatedeal->save(); // for($i = 0; $i < count($data['name']); $i++) { // $c= new delegateinfo(); // $c->name = $data['name'][$i]; // $c->email = $data['email'][$i]; // $c->mobile = $data['mobile'][$i]; // $c->desg = $data['desg'][$i]; // $c->Empid = $emid; // $c->leadid = $data['leadcode']; // $c->save(); // } return redirect('initiator/pendingactivity/'); }
public function postDelegatedealupload(Request $request) { $data = Input::get(); $eventcode = Input::get('eventname'); $result = explode('|', $eventcode, 2); $eventcode = trim($result[0]); $eventname = trim($result[1]); //emp id and name $eid = Input::get('emp_id'); $result = explode('|', $eid, 2); $emid = trim($result[0]); $ename = trim($result[1]); $leadid = Input::get('leadid'); $empdept = Input::get('empdept'); $billingaddress = $data['billingadd']; $billiong = preg_replace("/\r|\n/", "", $billingaddress); $dealstatus = '1'; $dealtype = 'single'; $c = new Deal(); $ydate = date('Y-m-d', strtotime("-1 days")); // dd($ydate); if ($data['deal_curr'] != 'INR') { $exchnagerate = $this->getExchangex($data['deal_value'], $data['deal_curr'], $ydate); } else { $exchnagerate = $data['deal_value']; } if ($data['kindofsub'] == 'paid') { $dealvalue = $data['deal_value']; $dealcurr = $data['deal_curr']; } if ($data['kindofsub'] == 'free') { $dealvalue = '0'; $dealcurr = '0'; } $c->Companyname = $data['company']; $c->billingadd = $billiong; $c->Eventcode = $eventcode; $c->Eventname = $eventname; $c->Dealdate = $data['dealdate']; $c->Dealvalue = $dealvalue; $c->kindofsub = $data['kindofsub']; $c->Dealcurr = $dealcurr; $c->Rcvalue = $exchnagerate; $c->Empid = $emid; $c->Empname = $ename; $c->leadcode = $data['leadcode']; $c->Status = $dealstatus; $c->Dealtype = $dealtype; $c->save(); $lastinsertid = $c->Id; $updatedeal = new delegatedealinfo(); $updatedeal->deal_id = $lastinsertid; $updatedeal->leadcode = $data['leadcode']; $updatedeal->boq = '1'; $updatedeal->vip = 'NULL'; $updatedeal->hotel = 'NULL'; $updatedeal->logo = 'NULL'; $updatedeal->save(); $benefit = new benefits(); $benefit->deal_id = $lastinsertid; $benefit->leadcode = $data['leadcode']; $benefit->hotelaccommodation = $data['hotelacc']; $benefit->specification = $data['specification']; $benefit->flightticket = $data['flight']; $benefit->airportpickupdrop = $data['airport']; $benefit->visa = $data['visa']; $benefit->save(); for ($i = 0; $i < count($data['name']); $i++) { // dd(count($data['name'])); $invemail = new invoiceemails(); $invemail->name = $data['name'][$i]; $invemail->email = $data['email'][$i]; $invemail->mobile = $data['mobile'][$i]; $invemail->desg = $data['desg'][$i]; $invemail->dept = $data['dept'][$i]; $invemail->invoicemark = $data['preferred'][$i]; $invemail->deal_id = $lastinsertid; $invemail->leadcode = $data['leadcode']; $invemail->save(); } return redirect('initiator/pendingactivity/'); }