Пример #1
0
        public CashPrint(Shop_SellList shopshelllist)
        {
            ssl = shopshelllist;
            //自定义纸张
            printDocument.DefaultPageSettings.PaperSize = ps;
            printDocument.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);

            //printDocument.Print();  //直接打印
            printView();  //打印预览
        }
Пример #2
0
        public Cash(Shop_SellList selllist)
        {
            InitializeComponent();

            ssl = selllist;

            dataGridView1.AutoGenerateColumns = false;

            dataGridView1.DataSource = ssl.Details;

            lbbillamount.Text = selllist.Details.Sum(x => x.Price * x.Amount).ToString("0.00");
            lbactamount.Text = lbbillamount.Text;
            lbbackamount.Text = GetBackAmount();
        }
Пример #3
0
        private void btnCash_Click(object sender, EventArgs e)
        {
            Shop_SellList sslback = null;

            //产生billno 写数据库  库存 要货单 打印
            if (!string.IsNullOrEmpty(ssl.BackBillNo))
            {
                sslback = new Shop_SellList();
                sslback.BackBillNo = ssl.BackBillNo;
                sslback.Duty = ssl.Duty;

                //产生一张完全的退货单
                DALShopSellList dalshopselllist = new DALShopSellList();

                Shop_SellList selllistback = dalshopselllist.GetByBillNO(ssl.BackBillNo);

                sslback.BillNO = new DALSys_FormatSerialNo().GetSerialNo(GlobalValue.GShop.ShopNo); ;
                sslback.Details.Clear();
                foreach (Shop_SellDetail ssd in selllistback.Details)
                {
                    Shop_SellDetail sdnew = new Shop_SellDetail();
                    sdnew.Amount = -ssd.Amount;
                    sdnew.Price = ssd.Price;
                    sdnew.Pro = ssd.Pro;
                    sdnew.BillNO = sslback.BillNO;
                    sslback.Details.Add(sdnew);
                }

                sslback.BillAmount = -selllistback.BillAmount;
                sslback.ActAmount = -selllistback.ActAmount;
                sslback.ActCustomAmount = -selllistback.ActCustomAmount;
                sslback.BackFlag = true;

                new DALShopSellList().SaveList(sslback);

                new DALUnity().ExcuteStoredProcedure("usp_Shop_Sell_Cash",
                new string[] { GlobalValue.GAccount.AccountID.ToString(),
                    GlobalValue.GShop.ShopID.ToString(),
                    sslback.BillNO});

                Program.mainfrm.dutyinfo.BackCount++;
                Program.mainfrm.dutyinfo.BackAmount += sslback.ActAmount;
                Program.mainfrm.dalduty.Save(Program.mainfrm.dutyinfo);

                ssl.BackBillNo = null;
                ssl.Details.Clear();
                foreach (Shop_SellDetail sd in Program.mainfrm.ReMoveDetails)
                {
                    sd.Amount = -sd.Amount;
                    ssl.Details.Add(sd);
                }

            }

            if (ssl.Details.Count > 0)
            {
                string billNo = new DALSys_FormatSerialNo().GetSerialNo(GlobalValue.GShop.ShopNo);
                ssl.BillNO = billNo;
                ssl.BillAmount = ssl.Details.Sum(x => x.Price * x.Amount);
                ssl.ActAmount = ssl.BillAmount;
                ssl.ActCustomAmount = ssl.BillAmount;
                ssl.BackFlag = false;

                foreach (Shop_SellDetail detail in ssl.Details)
                {
                    detail.BillNO = billNo;
                }

                new DALShopSellList().SaveList(ssl);

                Program.mainfrm.dutyinfo.BillCount++;
                Program.mainfrm.dutyinfo.ActAmount += ssl.ActAmount;
                Program.mainfrm.dutyinfo.BillAmount += ssl.BillAmount;

                Program.mainfrm.dalduty.Save(Program.mainfrm.dutyinfo);
                //执行存储过程,进行库存处理
                new DALUnity().ExcuteStoredProcedure("usp_Shop_Sell_Cash",
                    new string[] { GlobalValue.GAccount.AccountID.ToString(),
                    GlobalValue.GShop.ShopID.ToString(),
                    ssl.BillNO});
            }
            if (sslback != null)
            {

                new CashPrint(sslback);

            }
            if (ssl.Details.Count > 0)
            {
                new CashPrint(ssl);
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Пример #4
0
 private void NewBill(bool IsNew)
 {
     btnNew.Enabled = btnBack.Enabled = !IsNew;
     btnPre.Enabled = btnnext.Enabled = btnProSelect.Enabled = btnCash.Enabled = btncancel.Enabled = IsNew;
     if (!IsNew)
     {
         pnlselldetail.Controls.Clear();
         selllist = null;
     }
 }
Пример #5
0
 private void CreateBill()
 {
     //产生一个SellList
     selllist = new Shop_SellList();
     selllist.Duty = dutyinfo;
     NewBill(true);
     pnlselldetail.Tag = 0;
     ReMoveDetails.Clear();
 }