Difference between revisions of "CostBill class"

From Catglobe Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 26: Line 26:
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>ModifiedDate</nowiki>|HasGetter=1|Description=<nowiki>Date last modification</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>ModifiedDate</nowiki>|HasGetter=1|Description=<nowiki>Date last modification</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Name of the CostBill, same as EntryNumber</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Name of the CostBill, same as EntryNumber</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Note</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Note that the you can reference</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Paid</nowiki>|HasGetter=1|Description=<nowiki>True if was paid</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Paid</nowiki>|HasGetter=1|Description=<nowiki>True if was paid</nowiki>}}
Line 36: Line 37:
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}
 +
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
<span style="color:#DF8621">Create new CostBill resource</span>
 +
<source lang="javascript">
 +
string name = "test";
 +
number parent = 123456;
 +
CostBill c = new CostBill (name, parent);
 +
//c.CustomerGroupResourceId = 1234567;
 +
//c.AttentionToUserResourceId = 12345678;
 +
//c.IncurredUserResourceId = 123456789;
 +
//c.IncurredDay = new DateTime();
 +
LedgerEntry entry = new LedgerEntry ("entryName", c);
 +
entry.Description = "xxxx";
 +
entry.NumberOfUnits = 1;
 +
entry.UnitCost = 100;
 +
c.LedgerEntries.Add(entry);
 +
c.Save();
 +
</source>
 +
<span style="color:#DF8621">set Paid for existing CostBill and edit its ledgerEntry</span>
 +
<source lang="javascript">
 +
 +
CostBill c = new CostBill(123456);
 +
c.PaidDate = new DateTime();
 +
array  a = c.LedgerEntries;
 +
for (i for 0; a.Count)
 +
{
 +
LedgerEntry entry = a[i];
 +
entry.UnitCost = 100;
 +
}
 +
c.Save(); 
 +
</source>

Latest revision as of 03:42, 25 May 2022

CostBill



Cost object used to store costs bills for resources

Parent class

Inherits from object

Constructors

  • (int resourceId "Resource id of existing CostBill") - Get existing CostBill
  • (string name "Name of the CostBill", int parentResourceId "Resource id of the resource the CostBill is stored under") - Create new CostBill

Methods

  • Empty Save() - Save the CostBill and LedgerEntries
  • (From object) string ToString() - The string representation of the object.

Properties

  • number Amount { get; } - Sum of amount of ledgers
  • int AttentionToUserResourceId { get; set; } - Resource id of the user that is sent the CostBill
  • DateTime CreatedDate { get; } - Date of creation
  • int CurrencyId { get; } - Id of the currency used for costing
  • int CustomerGroupResourceId { get; set; } - Resource id of the group that is the supplier
  • DateTime DeletedDate { get; } - Deleted date if deleted
  • string EntryNumber { get; set; } - CostBill Id that the you can reference
  • int EntryType { get; set; } - 3 = Finance, 4 = Creditor
  • DateTime IncurredDay { get; set; } - Day the expense occured
  • int IncurredUserResourceId { get; set; } - Resource id of the user that is attributed the expense
  • CompatibilityArray LedgerEntries { get; } - List of ledgers
  • DateTime ModifiedDate { get; } - Date last modification
  • string Name { get; set; } - Name of the CostBill, same as EntryNumber
  • string Note { get; set; } - Note that the you can reference
  • string ObjectTypeName { get; } - The name of the type of object.
  • bool Paid { get; } - True if was paid
  • DateTime PaidDate { get; set; } - Date the CostBill was paid
  • int ParentResourceId { get; set; } - Resource id of the resource the CostBill is stored under
  • string Reference { get; set; } - CostBill Id that the supplier can reference
  • int ResourceId { get; } - Resource id of the CostBill
  • int ResourceTemplateResourceId { get; set; } - Resource id of the resource template used. 0 to use default
  • bool Submitted { get; set; } - Get/Set if CostBill is submitted yet or not
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.

Examples

Create new CostBill resource

string name = "test";
number parent = 123456;
CostBill c = new CostBill (name, parent);
//c.CustomerGroupResourceId = 1234567;
//c.AttentionToUserResourceId = 12345678;
//c.IncurredUserResourceId = 123456789;
//c.IncurredDay = new DateTime();
LedgerEntry entry = new LedgerEntry ("entryName", c);
entry.Description = "xxxx";
entry.NumberOfUnits = 1;
entry.UnitCost = 100;
c.LedgerEntries.Add(entry);
c.Save();

set Paid for existing CostBill and edit its ledgerEntry

CostBill c = new CostBill(123456);
c.PaidDate = new DateTime(); 
array  a = c.LedgerEntries;
for (i for 0; a.Count)
{
	LedgerEntry entry = a[i];
	entry.UnitCost = 100;
}
c.Save();