Difference between revisions of "Invoice new"

From Catglobe Wiki
Jump to: navigation, search
(Return type)
(Tag: visualeditor)
(Return type)
(Tag: visualeditor)
 
(2 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 119: Line 120:
 
|INVOICE_LEDGER
 
|INVOICE_LEDGER
 
|array of LedgerEntry object
 
|array of LedgerEntry object
|[[LedgerEntry new|LedgerEntry]]
+
|Invoice LedgerEntry, see [[LedgerEntry new|LedgerEntry]]
 
|-
 
|-
 
|INVOICE_TOTAL
 
|INVOICE_TOTAL
Line 127: Line 128:
  
 
== Example ==
 
== Example ==
//{30,0,test,11088827,2111,False,1,0,0,Empty,10768810,,{2018,1,2,0,0,0,0,1,65},{2018,1,2,0,0,0,0,1,65},{1,1,1,0,0,0,0,1,65},{1,1,1,7,0,0,0,1,65},{},0}
+
 
 
<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}