Difference between revisions of "Invoice new"
Nguyenduyan (talk | contribs) |
Nguyenduyan (talk | contribs) (→Return type) (Tag: visualeditor) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
+ | Create new an Invoice. The Invoice just save when using with [[Invoice_save]] | ||
== Syntax == | == Syntax == | ||
Line 28: | Line 29: | ||
Array of Invoice object | Array of Invoice object | ||
− | + | {| class="tableintopic" style="border: 1px solid rgb(1, 1, 1); border-collapse: collapse" width="875" cellspacing="0" cellpadding="2" border="1" | |
− | {| class="tableintopic" style="border: 1px solid rgb(1, 1, 1); border-collapse: collapse" | + | |- valign="top" align="left" |
− | |- | + | | style="border: 1px solid rgb(1, 1, 1)" width="292" bgcolor="#c0c0c0" | |
− | | style="border: 1px solid rgb(1, 1, 1)" bgcolor="#c0c0c0 | ||
'''Index''' | '''Index''' | ||
− | | style="border: 1px solid rgb(1, 1, 1)" bgcolor="#c0c0c0 | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" bgcolor="#c0c0c0" | |
'''Data type''' | '''Data type''' | ||
− | | style="border: 1px solid rgb(1, 1, 1)" bgcolor="#c0c0c0 | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" bgcolor="#c0c0c0" | |
'''Value''' | '''Value''' | ||
− | |- | + | |- valign="top" align="left" |
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_RESOURCE_ID | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="92" | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | number |
− | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Resource Id of Invoice | |
− | + | |- valign="top" align="left" | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | ||
− | Resource | ||
− | |||
− | |- | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_PART | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="92" | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | string |
− | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Name of Invoice | |
− | + | |- valign="top" align="left" | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | ||
− | Name of | ||
− | |||
− | |- | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_PARENT_RESOURCE_ID | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="92" | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | number |
− | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Invoice parent resource Id | |
− | + | |- valign="top" align="left" | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | ||
− | |||
− | |||
− | |- | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_TEMPLATE_RESOURCE_ID | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | number |
+ | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Invoice template Resource Id | ||
+ | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_SUBMITTED | |
− | |||
− | |||
− | |||
− | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | boolean |
− | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Invoice is submitted or not | |
− | + | |- valign="top" align="left" | |
− | |- | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_REVENUE_TYPE | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="92" | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | number |
− | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Invoice Revenue type | |
− | + | |- valign="top" align="left" | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | ||
− | |||
− | |||
− | |- | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_CUSTOMER_RESOURCE_ID | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="92" | | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | number |
− | + | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Invoice Customer Resource Id | |
− | + | |- valign="top" align="left" | |
− | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | ||
− | |||
− | |||
− | |- | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
− | + | INVOICE_REPRESENTATIVE_RESOURCE_ID | |
− | |||
− | |||
− | |||
− | | style="border: 1px solid rgb(1, 1, 1)" width=" | + | | style="border: 1px solid rgb(1, 1, 1)" width="92" | number |
− | |||
+ | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Invoice representative resource Id | ||
+ | |- | ||
+ | |INVOICE_ADDRESSED_TO | ||
+ | | | ||
+ | |Invoice address to | ||
+ | |- | ||
+ | |INVOICE_EARNER | ||
+ | |number | ||
+ | |Invoice earner Resource Id | ||
+ | |- | ||
+ | |INVOICE_REFERENCE | ||
+ | |string | ||
+ | |Invoice reference | ||
+ | |- | ||
+ | |INVOICE_INVOICE_DATE | ||
+ | |dateTime arrray | ||
+ | |Invoice date | ||
+ | |- | ||
+ | |INVOICE_DUE_DATE | ||
+ | |dateTime array | ||
+ | |Due date | ||
+ | |- | ||
+ | |INVOICE_PAID_DATE | ||
+ | |dateTime array | ||
+ | |Paid date | ||
+ | |- | ||
+ | |INVOICE_SUBMITTED_DATE | ||
+ | |dateTime array | ||
+ | |submitted date | ||
+ | |- | ||
+ | |INVOICE_LEDGER | ||
+ | |array of LedgerEntry object | ||
+ | |Invoice LedgerEntry, see [[LedgerEntry new|LedgerEntry]] | ||
+ | |- | ||
+ | |INVOICE_TOTAL | ||
+ | |number | ||
+ | |Invoice total | ||
|} | |} | ||
== Example == | == Example == | ||
− | + | ||
<source lang="javascript"> | <source lang="javascript"> | ||
+ | string invoiceName = "test3"; | ||
+ | number parentResourceId = 11088827; | ||
+ | number eraningUserRId = 10768810; | ||
+ | array invoiceDate = getCurrentDateTime(); | ||
+ | array dueDate = getCurrentDateTime(); | ||
+ | number templateInvoiceRId = 2111; | ||
+ | array invoice = Invoice_new (invoiceName, parentResourceId, eraningUserRId, invoiceDate, dueDate, templateInvoiceRId); | ||
+ | |||
+ | string ledgerName = "test4"; | ||
+ | string ledgerEntryDescription = "123"; | ||
+ | array ledgerEntry = LedgerEntry_new(ledgerName, ledgerEntryDescription); | ||
+ | invoice[INVOICE_LEDGER] = {ledgerEntry}; | ||
+ | Invoice_save(invoice); | ||
+ | print(invoice); | ||
+ | //{30,15599760,test3,11088827,2111,False,1,0,0,Empty,10768810,,{2018,1,11,0,0,0,0,2,65},{2018,1,11,0,0,0,0,2,65},{1,1,1,0,0,0,0,1,65},{1,1,1,7,0,0,0,1,65},{{31,5,339,test4,123,1,0,2,1,0,0}},0} | ||
</source> | </source> |
Latest revision as of 05:18, 11 January 2018
Invoice_new
Create new an Invoice. The Invoice just save when using with Invoice_save
Syntax
Invoice_new (string invoiceName, number parentResourceId, number eraningUserRId, DateTime invoiceDate, DateTime dueDate, number templateInvoiceRId);
Arguments
string invoiceName
number parentResourceId
number eraningUserRId
DateTime invoiceDate
DateTime dueDate
number templateInvoiceRId
Return type
Array of Invoice object
Index |
Data type |
Value |
INVOICE_RESOURCE_ID |
number | Resource Id of Invoice |
INVOICE_PART |
string | Name of Invoice |
INVOICE_PARENT_RESOURCE_ID |
number | Invoice parent resource Id |
INVOICE_TEMPLATE_RESOURCE_ID |
number | Invoice template Resource Id |
INVOICE_SUBMITTED |
boolean | Invoice is submitted or not |
INVOICE_REVENUE_TYPE |
number | Invoice Revenue type |
INVOICE_CUSTOMER_RESOURCE_ID |
number | Invoice Customer Resource Id |
INVOICE_REPRESENTATIVE_RESOURCE_ID |
number | Invoice representative resource Id |
INVOICE_ADDRESSED_TO | Invoice address to | |
INVOICE_EARNER | number | Invoice earner Resource Id |
INVOICE_REFERENCE | string | Invoice reference |
INVOICE_INVOICE_DATE | dateTime arrray | Invoice date |
INVOICE_DUE_DATE | dateTime array | Due date |
INVOICE_PAID_DATE | dateTime array | Paid date |
INVOICE_SUBMITTED_DATE | dateTime array | submitted date |
INVOICE_LEDGER | array of LedgerEntry object | Invoice LedgerEntry, see LedgerEntry |
INVOICE_TOTAL | number | Invoice total |
Example
string invoiceName = "test3";
number parentResourceId = 11088827;
number eraningUserRId = 10768810;
array invoiceDate = getCurrentDateTime();
array dueDate = getCurrentDateTime();
number templateInvoiceRId = 2111;
array invoice = Invoice_new (invoiceName, parentResourceId, eraningUserRId, invoiceDate, dueDate, templateInvoiceRId);
string ledgerName = "test4";
string ledgerEntryDescription = "123";
array ledgerEntry = LedgerEntry_new(ledgerName, ledgerEntryDescription);
invoice[INVOICE_LEDGER] = {ledgerEntry};
Invoice_save(invoice);
print(invoice);
//{30,15599760,test3,11088827,2111,False,1,0,0,Empty,10768810,,{2018,1,11,0,0,0,0,2,65},{2018,1,11,0,0,0,0,2,65},{1,1,1,0,0,0,0,1,65},{1,1,1,7,0,0,0,1,65},{{31,5,339,test4,123,1,0,2,1,0,0}},0}