Exemple #1
0
        private void btnPrtReceipt_Click(object sender, EventArgs e)
        {
            string sChkNum = dgvPendOrder.CurrentRow.Cells[1].Value.ToString();
            string sTotal  = dgvPendOrder.CurrentRow.Cells[9].Value.ToString();

            Hashtable htPay = new Hashtable();

            htPay["Staff"]    = userInfo.UsrName;
            htPay["ItemQty"]  = GetOrderItemCount(sChkNum);
            htPay["SubTotal"] = GetDgvItemTotalPrice(sChkNum);
            htPay["Total"]    = GetDgvItemTotalPrice(sChkNum);
            htPay["PayType"]  = "CASH";
            htPay["OrderNo"]  = sChkNum;

            htPay["Tendered"] = "0.00";
            htPay["Change"]   = "0.00";

            OnLoadSystemCommonData onLoadSystemCommonData = new OnLoadSystemCommonData();

            onLoadSystemCommonData.GetTAOrderItem();
            onLoadSystemCommonData.GetSysConfigList();
            onLoadSystemCommonData.GetTAMenuItemList();

            var lstOrderItem = CommonData.TaOrderItemList.Where(s => s.CheckCode.Equals(sChkNum));
            var lstOI        = lstOrderItem.ToList();

            #region VAT计算
            if (CommonData.SysConfigList.Any())
            {
                //税率
                htPay["Rate1"] = CommonData.SysConfigList.FirstOrDefault().VATPerct + "%";

                var lstVAT = from o in lstOI
                             join m in CommonData.TaMenuItemList on o.ItemCode equals m.DishCode
                             where !string.IsNullOrEmpty(m.IsWithoutVAT) && m.IsWithoutVAT.Equals("Y")
                             select new
                {
                    itemTotalPrice = o.ItemTotalPrice
                };

                decimal dTotal  = 0;
                decimal dVatTmp = 0;
                decimal dVat    = 0;
                if (lstVAT.Any())
                {
                    dTotal = lstVAT.ToList().Sum(vat => Convert.ToDecimal(vat.itemTotalPrice));
                    //交税
                    dVatTmp = (Convert.ToDecimal(CommonData.SysConfigList.FirstOrDefault().VATPerct) / 100) * dTotal;

                    dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero);
                }

                htPay["VAT-A"] = dVat.ToString();
                //税前
                htPay["Net1"] = (dTotal - dVat).ToString();
                //总价
                htPay["Gross1"] = dTotal.ToString();
                htPay["Rate2"]  = "0.00%";
                htPay["Net2"]   = (Convert.ToDecimal(sTotal) - dTotal).ToString();
                htPay["VAT-B"]  = "0.00";
                htPay["Gross2"] = (Convert.ToDecimal(sTotal) - dTotal).ToString();
            }
            else
            {
                htPay["Rate1"]  = "0.00%";
                htPay["Net1"]   = "0.00";
                htPay["VAT-A"]  = "0.00";
                htPay["Gross1"] = "0.00";
                htPay["Rate2"]  = "0.00%";
                htPay["Net2"]   = "0.00";
                htPay["VAT-B"]  = "0.00";
                htPay["Gross2"] = "0.00";
            }
            #endregion

            PrtPrint.PrtReceipt(lstOI, htPay);
        }
Exemple #2
0
        private void btnNotPaid_Click(object sender, EventArgs e)
        {
            htPay["Tendered"] = txtTendered.Text;
            htPay["Change"]   = txtChange.Text;

            OnLoadSystemCommonData onLoadSystemCommonData = new OnLoadSystemCommonData();

            onLoadSystemCommonData.GetTAOrderItem();
            onLoadSystemCommonData.GetSysConfigList();
            onLoadSystemCommonData.GetTAMenuItemList();

            var lstOrderItem = CommonData.TaOrderItemList.Where(s => s.CheckCode.Equals(chkNum));
            var lstOI        = lstOrderItem.ToList();

            #region VAT计算
            if (CommonData.SysConfigList.Any())
            {
                //税率
                htPay["Rate1"] = CommonData.SysConfigList.FirstOrDefault().VATPerct + "%";

                var lstVAT = from o in lstOI
                             join m in CommonData.TaMenuItemList on o.ItemCode equals m.DishCode
                             where !string.IsNullOrEmpty(m.IsWithoutVAT) && m.IsWithoutVAT.Equals("Y")
                             select new
                {
                    itemTotalPrice = o.ItemTotalPrice
                };

                decimal dTotal  = 0;
                decimal dVatTmp = 0;
                decimal dVat    = 0;
                if (lstVAT.Any())
                {
                    dTotal = lstVAT.ToList().Sum(vat => Convert.ToDecimal(vat.itemTotalPrice));
                    //交税
                    dVatTmp = (Convert.ToDecimal(CommonData.SysConfigList.FirstOrDefault().VATPerct) / 100) * dTotal;

                    dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero);
                }

                htPay["VAT-A"] = dVat.ToString();
                //税前
                htPay["Net1"] = (dTotal - dVat).ToString();
                //总价
                htPay["Gross1"] = dTotal.ToString();
                htPay["Rate2"]  = "0.00%";
                htPay["Net2"]   = (Convert.ToDecimal(txtTotal.Text) - dTotal).ToString();
                htPay["VAT-B"]  = "0.00";
                htPay["Gross2"] = (Convert.ToDecimal(txtTotal.Text) - dTotal).ToString();
            }
            else
            {
                htPay["Rate1"]  = "0.00%";
                htPay["Net1"]   = "0.00";
                htPay["VAT-A"]  = "0.00";
                htPay["Gross1"] = "0.00";
                htPay["Rate2"]  = "0.00%";
                htPay["Net2"]   = "0.00";
                htPay["VAT-B"]  = "0.00";
                htPay["Gross2"] = "0.00";
            }
            #endregion

            PrtPrint.PrtReceipt(lstOI, htPay);
        }
Exemple #3
0
        private void btnPrtReceipt_Click(object sender, EventArgs e)
        {
            Hashtable ht = SetPrtInfo();

            ht["Tendered"] = checkPaid;

            ht["Change"] = "0.00";

            //new SystemData().GetTaOrderItem();
            var lstOi = CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(checkCode) && s.BusDate.Equals(checkBusDate)).ToList();

            #region VAT计算
            if (CommonData.GenSet.Any())
            {
                ht["Rate1"] = CommonData.GenSet.FirstOrDefault().VATPer + @"%";

                var lstVAT = from oi in CommonData.TaOrderItem.Where(s => s.CheckCode.Equals(checkID) && s.BusDate.Equals(checkBusDate))
                             join mi in CommonData.TaMenuItem on oi.ItemCode equals mi.MiDishCode
                             where !string.IsNullOrEmpty(mi.MiRmk) && mi.MiRmk.Contains(@"Without VAT")
                             select new
                {
                    itemTotalPrice = oi.ItemTotalPrice
                };

                decimal dTotal  = 0.00m;
                decimal dVatTmp = 0.00m;
                decimal dVat    = 0.00m;

                if (lstVAT.Any())
                {
                    dTotal = lstVAT.ToList().Sum(vat => Convert.ToDecimal(vat.itemTotalPrice));
                    //交税
                    dVatTmp = (Convert.ToDecimal(CommonData.GenSet.FirstOrDefault().VATPer) / 100) * dTotal;

                    dVat = Math.Round(dVatTmp, 2, MidpointRounding.AwayFromZero);
                }

                ht["VAT-A"] = dVat.ToString();
                //税前
                ht["Net1"] = dTotal.ToString();
                //总价
                ht["Gross1"] = (dTotal - dVat).ToString();
                ht["Rate2"]  = "0.00%";
                ht["Net2"]   = (Convert.ToDecimal(checkTotalAmount) - dTotal).ToString();
                ht["VAT-B"]  = "0.00";
                ht["Gross2"] = (Convert.ToDecimal(checkTotalAmount) - dTotal).ToString();
            }
            else
            {
                ht["Rate1"]  = "0.00%";
                ht["Net1"]   = "0.00";
                ht["VAT-A"]  = "0.00";
                ht["Gross1"] = "0.00";
                ht["Rate2"]  = "0.00%";
                ht["Net2"]   = "0.00";
                ht["VAT-B"]  = "0.00";
                ht["Gross2"] = "0.00";
            }
            #endregion

            PrtPrint.PrtReceipt(lstOi, ht);
        }