Difference between revisions of "LedgerEntry new"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "Category:Cost {{HelpFiles}} = LedgerEntry_new = == Syntax == LedgerEntry_new (string ledgerName, string ledgerEntryDescription); == Arguments == string ''invoiceN...")
 
 
(5 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
  
 +
Create new LedgerEntry for an Invoice
  
 
== Syntax ==
 
== Syntax ==
Line 18: Line 19:
  
 
== Return type ==
 
== Return type ==
Array of Ledger Entry object
+
Array of [[CGS Constants list#Ledger entry constant|Ledger Entry object]]
 +
{| class="tableintopic" style="border: 1px solid rgb(1, 1, 1);  border-collapse: collapse" width="875" cellspacing="0" cellpadding="2" border="1"
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" bgcolor="#c0c0c0" |
 +
'''Index'''
  
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" bgcolor="#c0c0c0" |
 +
'''Data type'''
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" bgcolor="#c0c0c0" |
 +
'''Value'''
 +
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_ID
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | number
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" | Id of Entry
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_RESOURCE_ID
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | number
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" |
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_NAME
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | string
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry name
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_DESCRIPTION
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | string
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry description
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_UNIT
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | number
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry unit
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_COST
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | number
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry cost
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_CURRENCY_ID
 +
 +
| style="border: 1px solid rgb(1, 1, 1)" width="92" | number
 +
| style="border: 1px solid rgb(1, 1, 1)" width="491" | Entry currency Id
 +
|- valign="top" align="left"
 +
| style="border: 1px solid rgb(1, 1, 1)" width="292" |
 +
LEDGER_ENTRY_EXCHANGE_RATE
 +
 +
| 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,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}