当前位置: 首页>>代码示例>>PHP>>正文


PHP Receipt::save方法代码示例

本文整理汇总了PHP中Receipt::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Receipt::save方法的具体用法?PHP Receipt::save怎么用?PHP Receipt::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Receipt的用法示例。


在下文中一共展示了Receipt::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  * POST /accountreceivables
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('invoiceID' => 'required|max:50|', 'houseID' => 'required', 'amount' => 'required|min:2', 'paymenttype' => 'required', 'amountpayed' => 'required', 'paymenttyperef' => 'required'));
     if ($v->passes()) {
         $findHouse = Input::get('houseID');
         $propertyId = House::where('name', $findHouse)->pluck('propertyID');
         $propertyName = Property::where('id', $propertyId)->pluck('name');
         $agent_id = Sentry::getUser()->id;
         $gamount = Input::get('amount');
         $gpayed = Input::get('amountpayed');
         $initpaid = Input::get('initpaid');
         $b = $gamount - $gpayed;
         $id = Input::get('invoiceID');
         $balance = $gamount - $gpayed;
         $invoice = Invoice::find($id);
         $invoiceid = $invoice->id;
         $invoice->balance = $gamount - $gpayed;
         $invoice->amountpaid = $gpayed + $initpaid;
         $invoice->save();
         $reciept = new Receipt();
         $reciept->invoiceID = $invoice->id;
         $reciept->agent_id = $agent_id;
         $reciept->type = $invoice->type;
         $reciept->houseID = $invoice->houseID;
         $reciept->recipient = $invoice->recipient;
         $reciept->invoice_amt = $gpayed + $initpaid + $b;
         $reciept->amountpaid = $gpayed;
         $reciept->balance = $gamount - $gpayed;
         $reciept->duedate = $invoice->duedate;
         $reciept->save();
         $findTenant = $invoice->recipient;
         $ftname = strtok($findTenant, " ");
         $tenants = Tenant::where('name', $ftname)->get();
         foreach ($tenants as $tenant) {
             $t_name = $tenant->name;
             $to = $tenant->phone;
         }
         $payment = new Payment();
         $payment->invoiceID = Input::get('invoiceID');
         $payment->amount = Input::get('amount');
         $payment->amountpayed = Input::get('amountpayed');
         $payment->houseID = $findHouse;
         $payment->client = $invoice->recipient;
         $payment->property = $propertyName;
         $payment->balance = $gamount - $gpayed;
         $payment->paymenttype = Input::get('paymenttype');
         $payment->paymenttyperef = Input::get('paymenttyperef');
         $payment->save();
         #send an sms to the tenant
         $message = ' Hi ' . $t_name . ', Your payment of  Ksh. ' . number_format($gpayed, 2) . ' for invoice no. ' . $invoiceid . ' of ' . $findHouse . '   has been received successfully, due balance ' . number_format($balance, 2) . ', Thank you';
         Queue::push('SendSMS', array('message' => $message, 'number' => $to));
         return Redirect::route('show/receipts/index')->withFlashMessage('Payment received successfully');
     }
     return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors');
 }
开发者ID:jeremiteki,项目名称:mteja-laravel,代码行数:62,代码来源:PaymentController.php

示例2: actionSave

 public function actionSave()
 {
     if (isset($_POST)) {
         $trans = Yii::app()->db->beginTransaction();
         $member_name = '';
         $total = 0;
         $point = 0;
         try {
             $table_length = $_POST['table_length'];
             if ($table_length < 1) {
                 throw new Exception('Rollback Input');
             }
             if (empty($_POST['id_member'])) {
                 throw new Exception('Rollback Input');
             }
             for ($i = 0; $i < $table_length; $i++) {
                 $receipt = new Receipt();
                 $receipt->id_receipt = $_POST['id_receipt_list'][$i];
                 $receipt->receipt_date = $_POST['receipt_date_list'][$i];
                 $receipt->total_purchase = $_POST['total_purchase_list'][$i];
                 $receipt->nominal_point = $_POST['pointearned_list'][$i];
                 $receipt->id_member = $_POST['id_member'];
                 $receipt->id_rule = $_POST['id_rule_list'][$i];
                 $receipt->id_tenant = $_POST['id_tenant_list'][$i];
                 $receipt->username = Yii::app()->user->getId();
                 if ($receipt->validate() and $receipt->save()) {
                     $member = Member::model()->findByPk($_POST['id_member']);
                     $member_name = $member->first_name . ' ' . $member->family_name;
                     $member->point += $receipt->nominal_point;
                     if (!$member->update()) {
                         throw new Exception('Rollback on Update Point Member');
                     }
                     $total += $receipt->nominal_point;
                     $point = $member->point;
                 } else {
                     throw new Exception('Rollback on Receipt');
                 }
             }
             $trans->commit();
             $get_name = User::model()->findByPk(Yii::app()->user->getId());
             $dataReceipt = $this->renderPartial('_receipt', array('id_member' => $_POST['id_member'], 'member_name' => $member_name, 'new_point' => $total, 'old_point' => $point - $total, 'total_point' => $point, 'name' => $get_name->name), true, false);
             echo CJSON::encode(array('message' => 'Transaction add point has been saved Successfully!', 'receipt' => $dataReceipt));
         } catch (CDbException $e) {
             $trans->rollback();
         }
     }
 }
开发者ID:nicovicz,项目名称:reward-point,代码行数:47,代码来源:AddPointController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $rules = array('commodity' => 'required', 'quantity' => 'required', 'batch_no' => 'required', 'supplier' => 'required', 'expiry_date' => 'required|date');
     $validator = Validator::make(Input::all(), $rules);
     // process the login
     if ($validator->fails()) {
         return Redirect::route('receipt.index')->withErrors($validator);
     } else {
         $receipts = new Receipt();
         $receipts->commodity_id = Input::get('commodity');
         $receipts->supplier_id = Input::get('supplier');
         $receipts->quantity = Input::get('quantity');
         $receipts->batch_no = Input::get('batch_no');
         $receipts->expiry_date = Input::get('expiry_date');
         $receipts->user_id = Auth::user()->id;
         $receipts->save();
         return Redirect::route('receipt.index')->with('message', trans('messages.receipt-succesfully-added'));
     }
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:24,代码来源:ReceiptController.php

示例4: receivePayment

 public function receivePayment()
 {
     $input = Input::all();
     $v = Validator::make(Input::All(), array('invoiceID' => 'required|max:50|', 'houseID' => 'required', 'amountdue' => 'required|min:2', 'paymenttype' => 'required', 'amountpayed' => 'required', 'totalpaid' => 'required', 'paymenttyperef' => 'required', 'agent_id' => 'required'));
     if ($v->passes()) {
         $findHouse = Input::get('houseID');
         $propertyId = House::where('name', $findHouse)->pluck('propertyID');
         $propertyName = Property::where('id', $propertyId)->pluck('name');
         $agent_id = Input::get('agent_id');
         $gamount = Input::get('amountdue');
         $gpayed = Input::get('totalpaid');
         $currentPaid = Input::get('amountpayed');
         $initpaid = Input::get('initpaid');
         $cpaid = $gpayed + $currentPaid;
         $agent_id = Input::get('agent_id');
         $billedusr = User::find($agent_id);
         $hisBalance = $billedusr->credit_balance;
         $newBalance = $hisBalance - 3;
         $billedusr->credit_balance = $newBalance;
         $billedusr->save();
         $billstatement = new Statement();
         $billstatement->type = "Receiving Payment";
         $billstatement->amount = 3;
         $billstatement->save();
         $id = Input::get('invoiceID');
         $balance = $gamount - $cpaid;
         $invoice = Invoice::find($id);
         $invoiceid = $invoice->id;
         $invoice->balance = $gamount - $cpaid;
         $invoice->amountpaid = $cpaid;
         $invoice->save();
         // Create a new Receipt
         $reciept = new Receipt();
         $reciept->invoiceID = $invoice->id;
         $reciept->agent_id = $invoice->agent_id;
         $reciept->type = $invoice->type;
         $reciept->houseID = $invoice->houseID;
         $reciept->recipient = $invoice->recipient;
         $reciept->propertyid = $invoice->propertyid;
         $reciept->invoice_amt = $gamount;
         $reciept->amountpaid = $currentPaid;
         $reciept->balance = $gamount - $cpaid;
         $reciept->duedate = $invoice->duedate;
         $reciept->save();
         // Create a new payment report
         $payment = new Payment();
         $payment->invoiceID = Input::get('invoiceID');
         $payment->amount = Input::get('amountdue');
         $payment->amountpayed = Input::get('amountpayed');
         $payment->houseID = $findHouse;
         $payment->client = $invoice->recipient;
         $payment->property = $propertyName;
         $payment->balance = $gamount - $cpaid;
         $payment->paymenttype = Input::get('paymenttype');
         $payment->paymenttyperef = Input::get('paymenttyperef');
         $payment->save();
         #send an sms to the tenant
         $findTenant = $invoice->recipient;
         $ftname = strtok($findTenant, " ");
         $tenants = Tenant::where('name', $ftname)->get();
         foreach ($tenants as $tenant) {
             $t_name = $tenant->name;
             $to = $tenant->phone;
         }
         $message = ' Hi ' . $t_name . ', Your payment of  Ksh. ' . number_format($currentPaid, 2) . ' for ' . $findHouse . '   has been received successfully, due balance ' . number_format($balance, 2) . ', Thank you';
         //	Queue::push('SendSMS', array('message' =>$message ,'number'=>$to ));
         $noteP = array('error' => false, 'message' => 'Payment received successfully');
         return $noteP;
     }
     $notePE = array('error' => true, 'message' => $v->errors()->all());
     return $notePE;
 }
开发者ID:jeremiteki,项目名称:mteja-laravel,代码行数:72,代码来源:AndroidController.php

示例5: Receipt

* @author Christian Ehret <chris@ehret.name> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once '../includes/receiptclass.inc.php';
$receipt = new Receipt();
include_once '../includes/articleclass.inc.php';
$article = new Article();
$receiptid = -1;
$loaddraft = false;
$draftdeleted = false;
$smarty->assign('tpl_articles', $article->get());
// save receipt
if ($request->GetVar('frm_action', 'post') == "save") {
    $receiptid = $receipt->save();
    $smarty->assign('tpl_saved', 'true');
    $smarty->assign('tpl_location', $wwwroot . 'receiptrtf.php/receiptid.' . $receiptid . '/receiptrtf.php');
    // save draft receipt
} elseif ($request->GetVar('frm_action', 'post') == "savedraft") {
    $draftreceiptid = $receipt->savedraft();
    $smarty->assign('tpl_saved', 'draft');
    // do anything else than save
} elseif ($request->GetVar('frm_action', 'post') == "deletedraft") {
    $receipt->deletedraft($request->GetVar('frm_draftreceiptid', 'post'), true);
    $location = $wwwroot . "checkopenbookings.php/bookid." . $request->GetVar('frm_bookid', 'post') . "/checkopenbookings.php";
    header("Location: {$location}");
} else {
    $smarty->assign('tpl_saved', 'false');
    $shortstay = false;
    $smartyshortstay = 'false';
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:31,代码来源:receipt.php

示例6:

    }
    $checkoutProductsTable .= '<tr><td colspan="4">&nbsp;</td></tr>';
    $checkoutProductsTable .= '<tr>
                    <td>Totaal</td>
                    <td colspan="2">&nbsp;</td>
                    <td>' . $checkoutTotalPrice . '</td>
                </tr>';
    $checkoutProductsTable .= '<tr><td colspan="4">&nbsp;</td></tr>';
    $checkoutProductsTable .= '<tr><td>&nbsp;</td><td>BTW</td><td colspan="2">&nbsp;</td></tr>';
    $checkoutTotalVAT = number_format($checkoutTotalPrice * 0.06, 2);
    $checkoutTotalExVAT = $checkoutTotalPrice - $checkoutTotalVAT;
    $checkoutProductsTable .= '<tr>
                    <td>&nbsp;</td>
                    <td>Schaal</td>
                    <td>Over</td>
                    <td>EUR</td>
                </tr>';
    $checkoutProductsTable .= '<tr>
                    <td>&nbsp;</td>
                    <td>6%</td>
                    <td>' . $checkoutTotalExVAT . '</td>
                    <td>' . $checkoutTotalVAT . '</td>
                </tr>';
    $checkoutProductsTable .= '</table>';
    $Receipt->setEmployee($GLOBALS['_USER']);
    $Receipt->setPriceInVat($checkoutTotalPrice);
    $Receipt->setPriceExVat($checkoutTotalExVAT);
    $Receipt->save();
    $receiptId = $Receipt->getId();
}
include_once '/views/checkout.php';
开发者ID:andregimenez,项目名称:Capri,代码行数:31,代码来源:checkout.php


注:本文中的Receipt::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。