private void btnSave_Click(object sender, EventArgs e) { Producty_type pt = new Producty_type(); Product p = new Product(); ViewItems vi = new ViewItems(); pt.loadProductType(cboType.Text); int temp = pt.getIdproductType(); vi.loadViewItems(txtProduct.Text); double temp2 = vi.ItemId; p.setProductType(temp); p.setDescription(txtDescription.Text); p.setQty(Convert.ToDouble(txtQuantity.Text)); p.setAmount(Convert.ToDouble(txtAmount.Text)); p.setItemId(temp2); p.setOutBy(GLOBAL_VARS.ActiveUser.Username); if (this.active_product_id != 0) { p.setIdproducts(active_product_id); p.edit(); } else { p.Save(); } //DB2 Transaction goes here... if (cboType.Text == "Egg") { TransactionForDB2 tdb2 = new TransactionForDB2(); //for StockInTransaction Class tdb2.St.FromSupplier = 6; tdb2.St.Remarks = "Stockin from Poultry"; tdb2.St.TotalNoOfItems = 1; tdb2.St.TotalQty = Convert.ToDouble(txtQuantity.Text); tdb2.St.PreparedBy = GLOBAL_VARS.ActiveUser.Username; tdb2.St.ApprovedBy = GLOBAL_VARS.ActiveUser.Username; tdb2.St.ReceivedBy = GLOBAL_VARS.ActiveUser.Username; //for StockIn Class tdb2.S.ItemId = IdOfSelectedItem; tdb2.S.QtyIn = Convert.ToDouble(txtQuantity.Text); tdb2.addToCollectionOfS(tdb2.S); //for Quick report tdb2.Q.ItemCode = txtProduct.Text; tdb2.Q.ItemQty = Convert.ToDouble(txtQuantity.Text); tdb2.Q.ItemQtyStanding = ((Convert.ToDouble(f.getAttribute("db2", "items", "item_qty", "item_code", txtProduct.Text))) + tdb2.Q.ItemQty); tdb2.Q.TransactionType = "stock_in"; tdb2.ExecuteDB2Transaction(); } //end of DB2 Transaction vp.loadListviewItem(); }
string transaction_date; //CURDATE() #endregion Fields #region Constructors public TindahanExpenses(ViewItems passItem) { this.refNo = this.getAndUpdateSORef(); this.last_stockout_id = 0d; //for so table this.item = passItem; this.sales_order_no = ""; this.responsible_customer = 0d; this.responsible_agent = 0d; this.discount = 0d; this.grand_total = 0d; this.net_total = 0d; this.tendered_amount = 0d; this.change = 0d; this.delivery_date = "CURDATE()"; this.prepared_by = GLOBAL_VARS.ActiveUser.Username; //for quick report this.id = "NULL"; this.item_code = this.item.ItemCode; this.item_qty = 0d; this.item_qty_standing = 0d; TRANSACTION_TYPE = "stock_out"; this.transaction_date = "CURDATE()"; //for stockout table this.stockout_id = "NULL"; this.item_id = this.item.ItemId; this.qty_out = 0d; this.amount = 0d; this.discount_stockout = 0d; this.tracking_price = 0d; this.item_price = this.item.ItemPrice; //for account_receivable table this.so = ""; this.remarks = "unsettled"; this._date = "NOW()"; }
private void frmManageProduct_Load(object sender, EventArgs e) { //if (this.active_expenses_id != 0) //{ // Expenses ex = new Expenses(); // ex.loadExpenses(this.active_expenses_id); // this.cboType.Text = ex.getExpensesType(); // this.txtDescription.Text = ex.getDescription(); // this.txtAmount.Text = ex.getAmount().ToString(); // this.txtQuantity.Text = ex.getQuantity().ToString(); // this.txtRemarks.Text = ex.getRemarks(); // this.btnSave.Text = "UPDATE"; //} if(this.active_product_id !=0){ Product p = new Product(); ViewItems vi = new ViewItems(); Producty_type pt = new Producty_type(); p.loadProducts(this.active_product_id); pt.loadProductType(p.getIdProductType()); vi.loadViewItems(p.getItemId()); this.cboType.Text = pt.getDescription(); this.txtProduct.Text = vi.ItemCode; this.txtQuantity.Text = p.getQty().ToString(); this.txtAmount.Text = p.getAmount().ToString(); this.txtDescription.Text = p.getDescription(); this.btnSave.Text = "UPDATE"; } }