/var/www/hkosl.com/littleark/webadmin/models/PayeasePaymentDtl.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

class PayeasePaymentDtl extends BaseModel
{
    protected 
$table "payease_payment_dtl";

    public function 
payeasePayment()
    {
        return 
$this->belongsTo('PayeasePayment');
    }

    public function 
payeasePaymentSubmit()
    {
        return 
$this->belongsTo('PayeasePaymentSubmit');
    }

    public function 
invoiceItem()
    {
        return 
$this->belongsTo('InvoiceItem''invoice_item_id');
    }

    public function 
supplier()
    {
        return 
$this->belongsTo('Supplier');
    }

    public function 
currency()
    {
        return 
$this->belongsTo('Currency''currency_code''iso_code');
    }

    
/**
     * Payment = CNY
     * Supplier = IDR
     * Supplier Amount = CNY amount => IDR amount
     */
    // public function supplierAmount()
    // {
    //     return $this->settlement_amount;
    // }

    
public function appendXML($parent$root_tag 'payease_payment_dtl')
    {
        
$payment $parent->addChild($root_tag);
        
$payment->addChild('merchant_id'$this->supplier->code);
        
$payment->addChild('merchant_submid'$this->supplier->payease_sub_merchant_number);
        
$payment->addChild('merchant_bank_name'$this->supplier->payease_bank_name);
        
$payment->addChild('merchant_bank_city'$this->supplier->payease_bank_city);
        
$payment->addChild('merchant_bank_code'$this->supplier->payease_bank_code);
        
$payment->addChild('date'$this->createdate);
        
$payment->addChild('id'$this->id);
        
$payment->addChild('code'$this->code);
        
$payment->addChild('currency'$this->settlement_currency_code);
        
$payment->addChild('amount'number_format($this->settlement_amount2'.'''));
        return 
$payment;
    }
}