本文整理汇总了PHP中Receipt类的典型用法代码示例。如果您正苦于以下问题:PHP Receipt类的具体用法?PHP Receipt怎么用?PHP Receipt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Receipt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: receipts
public function receipts()
{
$Receipt = new Receipt();
$condos = $Receipt->Condo->find('list');
$receiptStatuses = $Receipt->ReceiptStatus->find('list', array('conditions' => array('active' => '1')));
$this->set(compact('condos', 'clients', 'receiptStatuses'));
if (isset($this->request->data['Receipt'])) {
$conditions = array('conditions');
if ($this->request->data['Receipt']['condo_id'] != '') {
$conditions['conditions']['Receipt.condo_id'] = $this->request->data['Receipt']['condo_id'];
}
if ($this->request->data['Receipt']['receipt_status_id'] != '') {
$conditions['conditions']['Receipt.receipt_status_id'] = $this->request->data['Receipt']['receipt_status_id'];
}
if ($this->request->data['Receipt']['payment_date'] != '') {
if (is_array($this->request->data['Receipt']['payment_date'])) {
$dateTmp = $this->request->data['Receipt']['payment_date']['day'] . '-' . $this->request->data['Receipt']['payment_date']['month'] . '-' . $this->request->data['Receipt']['payment_date']['year'];
$this->request->data['Receipt']['payment_date'] = $dateTmp;
}
$conditions['conditions']['Receipt.payment_date'] = $this->request->data['Receipt']['payment_date'];
}
$Receipt->contain(array('PaymentUser', 'ReceiptStatus', 'ReceiptPaymentType', 'Client', 'Condo', 'CancelUser'));
$this->set('receipts', $Receipt->find('all', $conditions));
$this->set('hasData', true);
}
}
示例2: get_receipt_data_from_server
function get_receipt_data_from_server()
{
$manager = new Management();
$data = $manager->get_list_of_product_info();
$receipt = new Receipt();
$receipt->get_data_from_array($data);
return $receipt;
}
示例3: testReceiptCanAddProductsToItTotal
public function testReceiptCanAddProductsToItTotal()
{
$receipt = new Receipt();
$product = new Keyboard();
$receipt->addToTotal($product);
$this->assertEquals(50, $receipt->getTotalPrice());
$receipt->addProductById(1);
$this->assertEquals(50, $receipt->getTotalPrice());
}
示例4: 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');
}
示例5: getReceipt
function getReceipt($receiptID)
{
$receipt = new Receipt();
$receipt->selectRecord($receiptID);
if (!($domDoc = $receipt->getDomDocument())) {
return false;
} else {
$xmlStr = $domDoc->dump_mem(true);
return $xmlStr;
}
}
示例6: add_receipt
public function add_receipt($receipt_data)
{
//new receipt
$receipt = new Receipt();
// get data
$receipt->get_data_from_array($receipt_data);
TEST($receipt->json_encode(false));
//compute the sequence of sql to add this receipt to db
$comma_seperated_list = $receipt->get_seperated_list();
TEST($comma_seperated_list);
//mysqli_query($this->db, "CALL test('$comma_seperated_list');");
}
示例7: get_import_product_data_from_server
function get_import_product_data_from_server($query)
{
$manager = new Management();
$data = $manager->get_list_of_import_product_info($query);
if (!isset($data['error'])) {
$list = new Receipt();
$list->get_data_from_array($data);
return $list;
} else {
return $data;
}
}
示例8: ValidateWithWebServiceSAT
public static function ValidateWithWebServiceSAT($rfc_emisor, $rfc_receptor, $total_factura, $uuid)
{
$web_service = "https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl";
$hora_envio = date("Y-m-d H:i:s");
try {
$client = new SoapClient($web_service);
} catch (Exception $e) {
echo '\\n Error de validación en WS Sat: ', $e->getMessage();
return 0;
}
$cadena = "re={$rfc_emisor}&rr={$rfc_receptor}&tt={$total_factura}&id={$uuid}";
$param = array('expresionImpresa' => $cadena);
try {
$respuesta = $client->Consulta($param);
} catch (Exception $ex) {
echo "\n Error en WebService SAT. " . $ex;
return 0;
}
$hora_recepcion = date("Y-m-d H:i:s");
if ($respuesta->ConsultaResult->Estado == 'Vigente') {
$cadena_encriptar = $hora_envio . '│' . $rfc_emisor . '│' . $rfc_receptor . '│' . $total_factura . '│' . $uuid . '│' . $hora_recepcion;
$md5 = md5($cadena_encriptar);
return $xml = Receipt::CreateReceiptXml($respuesta, $rfc_emisor, $rfc_receptor, $total_factura, $uuid, $web_service, $hora_envio, $hora_recepcion, $md5);
} else {
return 0;
}
}
示例9: setVariables
/**
* Contains the testing sample data for the IssueController.
*
* @return void
*/
public function setVariables()
{
// Initial sample storage data
$this->input = array('batch_no' => Receipt::find(1)->id, 'topup_request_id' => TopupRequest::find(1)->id, 'quantity_issued' => '20', 'receivers_name' => 'Lab2', 'remarks' => 'first issue');
// Edition sample data
$this->inputUpdate = array('batch_no' => Receipt::find(1)->id, 'topup_request_id' => TopupRequest::find(1)->id, 'quantity_issued' => '20', 'receivers_name' => 'Lab2', 'remarks' => 'first issue');
}
示例10: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new UserCredit();
if (isset($_GET['user'])) {
$model->user_id = $_GET['user'];
}
$users_lists = BaseModel::getAll('Users', array("condition" => "is_admin = 0 "));
$users = array();
foreach ($users_lists as $user) {
$users[$user->id] = $user->first_name . ' ' . $user->last_name . '(' . $user->username . ')';
}
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['UserCredit'])) {
$receipt = Receipt::model()->findByPk('81dc3453-b570-11e5-9a98-3c07717072c4');
$model->attributes = $_POST['UserCredit'];
$model->receipt_no = $receipt->receipt;
if ($model->save()) {
if ($model->payment_status == 'a') {
$trans_model = new UserTrans();
$trans_model->tran_type = 'PAYMENT_RECEIVED';
$trans_model->user_id = $model->user_id;
$trans_model->credit = $model->amount;
$trans_model->credit_id = $model->id;
$trans_model->save();
}
$receipt->receipt = $receipt->receipt + 1;
$receipt->save();
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'users' => $users));
}
示例11: list_import_product_to_json_data
public function list_import_product_to_json_data($data)
{
//new a new receipt
//basically, a Reiceipt is a list of product...
$receipt = new Receipt();
foreach ($data as $value) {
//new Product
$product = new ImportProduct($value['Import_Price']);
// add attribute to it
$product->add_attribute($value['Name'], new Unit($value['UnitName'], $value['Price']), $value['Id'], $value['ProductId']);
//add the product to the receipt
$receipt->add($product);
}
// return the receipt in json format
return $receipt->json_encode();
}
示例12: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
$receipts = Receipt::all();
$commodities = Commodity::has('receipts')->lists('name', 'id');
$sections = TestCategory::all()->lists('name', 'id');
return View::make('topup.create')->with('receipts', $receipts)->with('sections', $sections)->with('commodities', $commodities);
}
示例13: boot
public static function boot()
{
parent::boot();
//validation on create
static::creating(function ($customer) {
return $customer->isValid();
});
//This event will delete all related model in category model
static::deleted(function ($cs) {
//Deletes all customerlog related to a customer
$c = $cs->customerlog()->lists('id');
if (!empty($c)) {
Customerlog::destroy($c);
}
//Deletes all Receipt related to a customer
$r = $cs->receipt()->lists('id');
if (!empty($r)) {
Receipt::destroy($r);
}
//Deletes all Salelog related to a customer
$s = $cs->salelog()->lists('id');
if (!empty($s)) {
Salelog::destroy($s);
}
});
//validation on update
static::updating(function ($customer) {
//return $customer->isValid();
});
}
示例14: 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();
}
}
}
示例15: testDelete
/**
* Tests the update function in the ReceiptController
* @depends testStore
* @param void
* @return void
*/
public function testDelete()
{
$this->be(User::first());
$this->runStore($this->input);
$receipt = new ReceiptController();
$receipt->delete(1);
$receiptDeleted = Receipt::withTrashed()->find(1);
$this->assertNotNull($receiptDeleted->deleted_at);
}