More actions
Nguyenduyan (talk | contribs) |
Nguyenduyan (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
Create new LedgerEntry for an Invoice | |||
== Syntax == | == Syntax == | ||
Line 32: | Line 33: | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Id of Entry | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_NAME | |||
| 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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry name | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_DESCRIPTION | |||
| 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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry description | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_UNIT | |||
| 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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry unit | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_COST | |||
| 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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry cost | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_CURRENCY_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" | | | style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry currency Id | ||
|- valign="top" align="left" | |- valign="top" align="left" | ||
| style="border: 1px solid rgb(1, 1, 1)" width="292" | | | style="border: 1px solid rgb(1, 1, 1)" width="292" | | ||
LEDGER_ENTRY_EXCHANGE_RATE | |||
| 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" |Entry exchange rate | |||
|- | |||
|LEDGER_ENTRY_AMOUNT_SELECTED_CURRENCY | |||
|numer | |||
|Entry amount selected currency | |||
|- | |||
|LEDGER_ENTRY_AMOUNT_DEFAULT_CURRENCY | |||
|number | |||
|Entry amount selected currency | |||
|} | |} | ||
== Example == | == Example == | ||
<source lang="javascript"> | <source lang="javascript"> | ||
//{31, | string invoiceName = "InvoiceTest"; | ||
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 = "123xyz"; | |||
array ledgerEntry = LedgerEntry_new(ledgerName, ledgerEntryDescription); | |||
ledgerEntry[LEDGER_ENTRY_UNIT]=1; | |||
ledgerEntry[LEDGER_ENTRY_COST ]=200; | |||
ledgerEntry[LEDGER_ENTRY_CURRENCY_ID] =1; | |||
invoice[INVOICE_LEDGER] = {ledgerEntry}; | |||
Invoice_save(invoice); | |||
print(ledgerEntry);//{31,6,341,test4,123xyz,1,200,1,1,200,200} | |||
</source> | </source> |
Latest revision as of 04:36, 11 January 2018
LedgerEntry_new
Create new LedgerEntry for an Invoice
Syntax
LedgerEntry_new (string ledgerName, string ledgerEntryDescription);
Arguments
string invoiceName
string ledgerEntryDescription
Return type
Array of Ledger Entry object
Index |
Data type |
Value |
LEDGER_ENTRY_ID |
number | Id of Entry |
LEDGER_RESOURCE_ID |
number | |
LEDGER_ENTRY_NAME |
string | Entry name |
LEDGER_ENTRY_DESCRIPTION |
string | Entry description |
LEDGER_ENTRY_UNIT |
number | Entry unit |
LEDGER_ENTRY_COST |
number | Entry cost |
LEDGER_ENTRY_CURRENCY_ID |
number | Entry currency Id |
LEDGER_ENTRY_EXCHANGE_RATE |
number | Entry exchange rate |
LEDGER_ENTRY_AMOUNT_SELECTED_CURRENCY | numer | Entry amount selected currency |
LEDGER_ENTRY_AMOUNT_DEFAULT_CURRENCY | number | Entry amount selected currency |
Example
string invoiceName = "InvoiceTest";
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 = "123xyz";
array ledgerEntry = LedgerEntry_new(ledgerName, ledgerEntryDescription);
ledgerEntry[LEDGER_ENTRY_UNIT]=1;
ledgerEntry[LEDGER_ENTRY_COST ]=200;
ledgerEntry[LEDGER_ENTRY_CURRENCY_ID] =1;
invoice[INVOICE_LEDGER] = {ledgerEntry};
Invoice_save(invoice);
print(ledgerEntry);//{31,6,341,test4,123xyz,1,200,1,1,200,200}