public void CalculateOutStock() { MVStockCostDocumentItem o = new MVStockCostDocumentItem(new CTable("")); calculateField(o, "JanAmount"); calculateField(o, "FebAmount"); calculateField(o, "MarAmount"); calculateField(o, "AprAmount"); calculateField(o, "MayAmount"); calculateField(o, "JunAmount"); calculateField(o, "JulAmount"); calculateField(o, "AugAmount"); calculateField(o, "SepAmount"); calculateField(o, "OctAmount"); calculateField(o, "NovAmount"); calculateField(o, "DecAmount"); calculateField(o, "TotAmount"); OutStock = o; BeginStockBalance = BeginStock.JanAmount; EndStockBalance = EndingStock.DecAmount; InAmount = InStock.TotAmount; OutAmount = OutStock.TotAmount; }
private void populateItem(ArrayList arr, MVStockCostDocumentItem item, String type) { item.ItemType = type; if (!item.ExtFlag.Equals("E")) { item.ExtFlag = "A"; } arr.Add(item.GetDbObject()); }
private void TxtDec_TextChanged(object sender, TextChangedEventArgs e) { MVStockCostDocumentItem item = ItemObj; TextBox tb = (TextBox)sender; if (item == null) { return; } item.DecAmount = tb.Text; updateTotal(); TextChanged?.Invoke(sender, e); }
private void calculateField(MVStockCostDocumentItem o, String fieldName) { Type typeBegin = BeginStock.GetType(); PropertyInfo infoBegin = typeBegin.GetProperty(fieldName); double beginAmt = CUtil.StringToDouble((String)infoBegin.GetValue(BeginStock, null)); Type typeIn = InStock.GetType(); PropertyInfo infoIn = typeIn.GetProperty(fieldName); double inAmt = CUtil.StringToDouble((String)infoIn.GetValue(InStock, null)); Type typeEnd = EndingStock.GetType(); PropertyInfo infoEnd = typeEnd.GetProperty(fieldName); double endAmt = CUtil.StringToDouble((String)infoEnd.GetValue(EndingStock, null)); double outAmt = beginAmt + inAmt - endAmt; Type typeOut = o.GetType(); PropertyInfo infoOut = typeOut.GetProperty(fieldName); infoOut.SetValue(o, outAmt.ToString()); }
public override void InitializeAfterLoaded() { Hashtable hash = new Hashtable(); CTable o = GetDbObject(); ArrayList arr = o.GetChildArray("COST_DOC_ITEMS"); if (arr == null) { arr = new ArrayList(); o.AddChildArray("COST_DOC_ITEMS", arr); } foreach (CTable t in arr) { String type = t.GetFieldValue("ITEM_TYPE"); hash.Add(type, t); } for (int i = 1; i <= 4; i++) { String type = i.ToString(); CTable obj = null; if (!hash.Contains(type)) { obj = new CTable(""); obj.SetFieldValue("ITEM_TYPE", type); obj.SetFieldValue("EXT_FLAG", "A"); hash[type] = obj; } } beginStock = new MVStockCostDocumentItem((CTable)hash["1"]); endStock = new MVStockCostDocumentItem((CTable)hash["2"]); inStock = new MVStockCostDocumentItem((CTable)hash["3"]); outStock = new MVStockCostDocumentItem((CTable)hash["4"]); }