public void set_transaction_by_wid(long SyncId, bool status) { this.syncid = SyncId; string sSQL = "SELECT * FROM `saleshead` WHERE `SyncId` = " + SyncId; DataTable dt = mySQLFunc.getdb(sSQL); if (dt.Rows.Count <= 0) { this.syncid = 0; return; } DataRow dr = dt.Rows[0]; this.OfficialReceiptNo = long.Parse(dr["ornumber"].ToString()); this.adjust = Convert.ToDecimal(dr["adjust"]); this.discount = Convert.ToDecimal(dr["discount1"]); this.salesdatetime = DateTime.Parse(dr["date"].ToString()); this.senior = new cls_senior(); this.senior.set_senior(dr["seniorno"].ToString(), dr["seniorname"].ToString()); this.memo = dr["memo"].ToString(); Int32.TryParse(dr["show"].ToString(), out this.show); Int32.TryParse(dr["status"].ToString(), out this.status); this.clerk = new cls_user(Convert.ToInt32(dr["userid"]), status); this.checker = new cls_user(Convert.ToInt32(dr["checkerid"]), status); this.customer = new cls_customer(Convert.ToInt32(dr["customerid"]), status); this.member = new cls_member(Convert.ToInt32(dr["memberid"]), status); this.payments = new cls_payment(SyncId); this.productlist = new cls_productlist(); this.productlist.set_productlist_by_wid(SyncId, status); }
public cls_productlist() { this.transDiscount = new cls_discountlist(0); this.list_product = new List <cls_product>(); this.dtproducts = new DataTable(); this.dtproducts.Columns.Add("VatStatus"); this.dtproducts.Columns.Add("productname"); this.dtproducts.Columns.Add("qty"); this.dtproducts.Columns.Add("price"); this.dtproducts.Columns.Add("amount"); this.isnonvat = false; this.iswholesale = false; this.issenior = false; this.customer = new cls_customer(); }
//constructor public cls_POSTransaction() { this.syncid = 0; this.OfficialReceiptNo = 0; this.adjust = 0; this.discount = 0; this.salesdatetime = DateTime.Now; this.productlist = new cls_productlist(); this.clerk = new cls_user(); this.checker = new cls_user(); this.salesman = new cls_user(); this.customer = new cls_customer(); this.member = new cls_member(); this.payments = new cls_payment(); this.senior = new cls_senior(); this.nonvat = new cls_nonvat(); this.memo = ""; this.UserAuthorizer = new cls_user(); this.show = 0; this.status = 0; }
public void reset_data_by_mode(bool isnonvat_d, bool issenior_d, bool iswholesale, int pricingtype, decimal pricingrate, cls_customer customer) { this.barcode = this.singlebarcode; this.pprice = this.retailpprice; this.origprice = this.retailprice; this.price = this.retailprice; if (iswholesale && this.syncid != 0) { if (pricingtype == 0 && customer.getItemPriceDictionary().ContainsKey(syncid)) { this.origprice = wholesaleprice; this.price = wholesaleprice; if (!this.customerHistoricalPricingFlag) { getProductDiscountList().appendDiscount(cls_globalvariables.dcdetail_adjusttype, customer.getItemPriceDictionary()[syncid] - this.origprice, false); customerHistoricalPricingFlag = true; } } else { if (pricingtype == 2) { this.origprice = Math.Round(this.pprice * (1 + (pricingrate / 100)), 2, MidpointRounding.AwayFromZero); } else if (pricingtype == 3) { this.origprice = Math.Round(this.wholesaleprice * (1 + (pricingrate / 100)), 2, MidpointRounding.AwayFromZero); } else if (pricingtype == 9) { this.origprice = this.retailprice; } else { this.origprice = this.wholesaleprice; } this.price = this.origprice; if (this.customerHistoricalPricingFlag) { getProductDiscountList().disable_all_discounts(); customerHistoricalPricingFlag = false; } } } else if (this.customerHistoricalPricingFlag) { getProductDiscountList().disable_all_discounts(); customerHistoricalPricingFlag = false; } Console.WriteLine("reset_data_by_mode discount : " + this.discount); Console.WriteLine("reset_data_by_mode adjust : " + this.adjust); Console.WriteLine("reset_data_by_mode 1: oprice: " + this.origprice); this.productdiscount.deactivateDiscount(cls_globalvariables.dcdetail_senior); this.productdiscount.deactivateDiscount(cls_globalvariables.dcdetail_senior5); this.productdiscount.deactivateDiscount(cls_globalvariables.dcdetail_nonvat); if (!this.is_history) { this.productdiscount.deactivateDiscount(cls_globalvariables.dcdetail_promoqty); } Console.WriteLine("reset_data_by_mode 2: oprice: " + this.origprice); if (issenior_d && (this.issenior == 1)) { this.productdiscount.activateDiscount(cls_globalvariables.dcdetail_senior, 1 - cls_globalvariables.senior, true); if (this.isvat) { this.productdiscount.activateDiscount(cls_globalvariables.dcdetail_nonvat, 1 / (1 + cls_globalvariables.vat), true); } } if (issenior_d && (this.issenior == 2)) { //Senior Transaction, Senior 5% item this.productdiscount.activateDiscount(cls_globalvariables.dcdetail_senior5, 1 - cls_globalvariables.senior5, true); } else if (isnonvat_d && this.isvat) { this.productdiscount.activateDiscount(cls_globalvariables.dcdetail_nonvat, 1 / (1 + cls_globalvariables.vat), true); } Console.WriteLine("reset_data_by_mode 3: oprice: " + this.origprice); //detail discount decimal tmp_disc = this.productdiscount.get_discounts_percentage(this.origprice); /*-------------------------------------------------*/ //ROBI Console.WriteLine("reset_data_by_mode price: " + this.price); Console.WriteLine("reset_data_by_mode discount : " + this.discount); Console.WriteLine("reset_data_by_mode adjust : " + this.adjust); // COMPUTE PRICE //detaildiscount = distributed head discounts and detaildiscount //1st run set detail discounts //2nd run distribute head discounts this.discount = 1 - (1M - this.discount) * (1M - tmp_disc); setPrice((getPrice() + this.adjust) * (1 - this.discount)); this.price = Math.Round(this.price, 2, MidpointRounding.AwayFromZero); //When fixing reset data by mode //setPrice((getOrigPrice() + this.adjust) * (1 - this.discount)); //if (this.discount != 0) // this.price = this.origprice * (1 - this.discount); //else // this.price = this.origprice + this.adjust; this.amount = this.qty * getPrice(); Console.WriteLine("reset_data_by_mode dc: " + this.price); if (isnonvat_d || (!this.isvat) || (issenior_d && (this.issenior == 1))) { this.vat = 0; } else { this.vat = calculate_vat(this.isvat, this.price); } if (this.adjust != 0) { this.price_suffix = "ADJ by " + this.adjust.ToString("N2") + " (Orig. Price: " + this.origprice.ToString("N2") + " )"; } else if (this.discount != 0) { this.price_suffix = "Discount by " + (this.discount * 100).ToString("N2") + "%" + " (Orig. Price: " + this.origprice.ToString("N2") + " )"; } else { this.price_suffix = ""; } this.productmode = (this.isvat) ? "V " : "NV "; this.productmode += ((this.issenior != 0) && issenior_d) ? "S" : "NS"; if (this.qty > 0 && (!this.isvat || isnonvat_d) && (!issenior_d || this.issenior != 1) || (this.syncid < 10 && this.syncid > 0)) { this.transaction_mode = "nonvat_sale"; } else if (this.qty < 0 && (!this.isvat || isnonvat_d) && (!issenior_d || this.issenior != 1)) { this.transaction_mode = "nonvat_return"; } else if (this.qty > 0 && this.isvat && !isnonvat_d && (!issenior_d || this.issenior != 1)) { this.transaction_mode = "vatable_sale"; } else if (this.qty < 0 && this.isvat && !isnonvat_d && (!issenior_d || this.issenior != 1)) { this.transaction_mode = "vatable_return"; } else if (this.qty > 0 && (issenior_d && this.issenior == 1)) { this.transaction_mode = "nonvat_sale"; } else if (this.qty < 0 && (issenior_d && this.issenior == 1)) { this.transaction_mode = "nonvat_return"; } else { this.transaction_mode = "vatable_sale"; } }
public void setcustomer(cls_customer customer_d) { this.customer = customer_d; this.productlist.set_customer(customer_d); }
public void set_customer(cls_customer customer) { this.customer = customer; }