Difference between revisions of "LedgerEntry new"

From Catglobe Wiki
Jump to: navigation, search
(LedgerEntry_new)
(Tag: visualeditor)
 
Line 92: Line 92:
  
 
<source lang="javascript">
 
<source lang="javascript">
//{31,0,0,test4,123,1,0,2,1,0,0}
+
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 05: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}