Ejemplo n.º 1
0
        public frmXSOrderDetail(string sheet_no)
        {
            InitializeComponent();
            //设置表格
            this.dataGridView1.Font = new Font("微软雅黑", 11);
            this.dataGridView1.AutoGenerateColumns = false;
            foreach (System.Windows.Forms.DataGridViewColumn col in this.dataGridView1.Columns)
            {
                col.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
            }
            dataGridView1.ReadOnly           = true;
            dataGridView1.AllowUserToAddRows = false;
            //
            cons.ClickActive.addActive(pnlclose, 2);
            cons.ClickActive.addActive(pnl_first, 2);
            cons.ClickActive.addActive(pnl_prev, 2);
            cons.ClickActive.addActive(pnl_next, 2);
            cons.ClickActive.addActive(pnl_last, 2);
            //
            lbl_title.Text = "销售出库单-" + sheet_no;
            IBLL.ISaleData bll = new BLL.SaleData();
            all_dt = bll.GetSaleSheetDetail(sheet_no);
            int m = (int)Math.Ceiling((decimal)this.total / (decimal)this.pageSize);

            this.pageCount       = m;
            lbl_order_count.Text = all_dt.Rows.Count.ToString();
            lbl_total_amt.Text   = all_dt.Compute("sum(sale_money)", "").ToString();

            this.pageChanged();
        }
Ejemplo n.º 2
0
        //挂账/预付单据
        private void CreditPayOrder()
        {
            if (this.lines.Count <= 0)
            {
                new MsgForm("无商品明细").ShowDialog();
                return;
            }
            IBLL.ISaleData bll = new BLL.SaleData();
            if (supcus_no == "")
            {
                new MsgForm("未选择客户").ShowDialog();
                return;
            }

            if (new YesNoForm("确认挂账/预付?").ShowDialog() == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    insertTHRK("", 0);
                    bll.SubmitOrder(lblsheet_no.Text, 1, Program.oper_id);
                    new MsgForm("单据提交成功!").ShowDialog();
                    clear_data();
                    newOrder("销售退货");
                }
                catch (Exception ex)
                {
                    new MsgForm("操作异常:" + ex.GetMessage()).ShowDialog();
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        private void btn_change_qty_Click(object sender, EventArgs e)
        {
            var row = dataGridView1.CurrentRow;

            if (row != null && row.Tag != null && row.Tag.ToString() != "")
            {
                if (Program.oper_type != "1000")
                {
                    //new MsgForm("当前用户不属于[系统管理员]组").ShowDialog();
                    return;
                }

                InputNumerForm frm = new InputNumerForm("数量", 2);
                decimal        qty = 0;
                if (frm.Input(out qty) == true)
                {
                    if (qty <= 0)
                    {
                        new MsgForm("数量不正确").ShowDialog();
                        return;
                    }
                    else
                    {
                        int            flow_id = Conv.ToInt(row.Tag);
                        var            line    = this.lines.FirstOrDefault(d => d.flow_id == flow_id);
                        IBLL.ISaleData bll     = new BLL.SaleData();
                        bll.UpdateSaleFlowQty(line.sheet_no, flow_id, qty, Program.oper_id);
                        line.qty = qty;
                        line.amt = line.qty * line.price;
                        this.ShowLine();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void ShowSelectedGoods()
        {
            if (currGoods != null)
            {
                IBLL.ISaleData bll = new BLL.SaleData();
                if (supcus_no != "")
                {
                    if (bll.CheckCusIsRetail(supcus_no))
                    {
                        lbl_price.Text = currGoods.base_price.ToString("F2");//一级批发价
                    }
                    else
                    {
                        IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                        lbl_price.Text = bll2.GetCusItemPrice(supcus_no, currGoods.item_no).ToString("F2"); //在线取客户零批价
                    }
                }
                else
                {
                    lbl_price.Text = currGoods.base_price.ToString("F2");//一级批发价
                }

                lblgoods.Text = currGoods.item_name;

                //自动取重模式:称重商品将自动取重
                if (Program.weight_model == "2" && currGoods.item_flag == "1")
                {
                    inputQty("取重");
                }
            }
        }
Ejemplo n.º 5
0
        private void pnl_search_Click(object sender, EventArgs e)
        {
            pnlboard.Visible = false;

            IBLL.ISaleData bll         = new BLL.SaleData();
            int            order_count = 0;
            decimal        total_amt   = 0;
            decimal        give_amt    = 0;
            string         order_key   = "SO";

            if (radioButton2.Checked)
            {
                order_key = "PI";
            }
            else if (radioButton3.Checked)
            {
                order_key = "RI";
            }
            bll.GetSaleFlowSum(pnldate1.Text, pnldate2.Text, order_key, out order_count, out total_amt, out give_amt);

            lbl_order_count.Text = order_count.ToString();
            lbl_total_amt.Text   = total_amt.ToString("F2");
            lbl_give_amt.Text    = give_amt.ToString("F2");
            this.pnl_first_Click(pnl_first, null);
        }
Ejemplo n.º 6
0
        private void pageChanged()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

                this.dataGridView1.Rows.Clear();

                IBLL.ISaleData bll = new BLL.SaleData();
                all_dt = bll.GetInOutSheet(pnldate1.Text, pnldate2.Text, pageIndex, pageSize, out total);
                int m = (int)Math.Ceiling((decimal)this.total / (decimal)this.pageSize);
                this.pageCount = m;

                foreach (DataRow dr in all_dt.Rows)
                {
                    var index = this.dataGridView1.Rows.Add();
                    var row   = this.dataGridView1.Rows[index];
                    row.Tag            = dr["sheet_no"].ToString();
                    row.Cells[0].Value = (index + 1).ToString();
                    row.Cells[1].Value = dr["sheet_no"].ToString();
                    row.Cells[2].Value = dr["sup_name"].ToString();

                    var pay_way = dr["pay_way"].ToString();
                    if (pay_way == "A")
                    {
                        row.Cells[3].Value = "现金支付";
                    }
                    else if (pay_way == "W")
                    {
                        row.Cells[3].Value = "微信支付";
                    }
                    else if (pay_way == "Z")
                    {
                        row.Cells[3].Value = "支付宝支付";
                    }
                    else
                    {
                        row.Cells[3].Value = "挂账/预付";
                    }

                    row.Cells[4].Value = Conv.ToDecimal(dr["total_amount"]).ToString("F2");
                    row.Cells[5].Value = Conv.ToDecimal(dr["inout_amount"]).ToString("F2");
                    row.Cells[6].Value = (dr["is_upload"].ToString() == "1" ? "已上传" : "未上传");
                    row.Cells[7].Value = dr["oper_date"].ToString();
                }

                this.Label1.Text = string.Format("第{0}页,共{1}页", this.pageIndex.ToString(), this.pageCount.ToString());
            }
            catch (Exception e)
            {
                new MsgForm(e.Message).ShowDialog();
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Ejemplo n.º 7
0
        //现结单据
        private void CashPayOrder()
        {
            if (this.lines.Count <= 0)
            {
                new MsgForm("无商品明细").ShowDialog();
                return;
            }
            IBLL.ISaleData bll = new BLL.SaleData();

            if (supcus_no == "")
            {
                new MsgForm("未选择客户").ShowDialog();
                return;
            }
            frmPay frm2 = new frmPay("2");
            //应付
            decimal yf = lines.Sum(d => d.qty * d.price);
            //实付
            decimal sf       = 0;
            string  pay_way2 = "";
            var     res2     = frm2.Cash(yf, out sf, out pay_way2);

            if (res2)
            {
                try
                {
                    var item = new Model.ot_pay_flow();
                    item.sheet_no    = lblsheet_no.Text;
                    item.cus_no      = supcus_no;
                    item.oper_id     = Program.oper_id;
                    item.oper_date   = DateTime.Now;
                    item.pay_way     = pay_way2;
                    item.sale_amount = yf;
                    item.pay_amount  = sf;
                    item.old_amount  = yf;
                    item.jh          = Program.jh;
                    item.ml          = 0;
                    int flow_id = 0;
                    bll.InsertPayFlow(item, out flow_id);

                    insertTHRK(pay_way2, sf);
                    bll.SubmitOrder(lblsheet_no.Text, 1, Program.oper_id);
                    new MsgForm("单据提交成功!").ShowDialog();
                    clear_data();
                    newOrder("销售退货");
                }
                catch (Exception ex)
                {
                    new MsgForm("操作异常:" + ex.GetMessage()).ShowDialog();
                    return;
                }
            }
        }
Ejemplo n.º 8
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            var row = dataGridView1.CurrentRow;

            if (row != null && row.Tag != null && row.Tag.ToString() != "")
            {
                int            flow_id = Conv.ToInt(row.Tag);
                var            line    = this.lines.FirstOrDefault(d => d.flow_id == flow_id);
                IBLL.ISaleData bll     = new BLL.SaleData();
                bll.DeleteSaleFlow(line.sheet_no, flow_id, Program.oper_id);
                this.lines.Remove(line);
                this.ShowLine();
            }
        }
Ejemplo n.º 9
0
 private void pageChanged()
 {
     try
     {
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
         //
         this.dataGridView1.Rows.Clear();
         IBLL.ISaleData bll       = new BLL.SaleData();
         string         order_key = "SO";
         if (radioButton2.Checked)
         {
             order_key = "PI";
         }
         else if (radioButton3.Checked)
         {
             order_key = "RI";
         }
         all_list = bll.GetSaleFlow(pnldate1.Text, pnldate2.Text, order_key, pageIndex, pageSize, out total);
         foreach (Model.t_order_detail item in all_list)
         {
             var index = this.dataGridView1.Rows.Add();
             var row   = this.dataGridView1.Rows[index];
             row.Tag            = item.sheet_no;
             row.Cells[0].Value = (index + 1).ToString();
             row.Cells[1].Value = item.sheet_no;
             row.Cells[2].Value = item.item_name;
             row.Cells[3].Value = item.qty.ToString("F3");
             row.Cells[4].Value = item.price.ToString("F2");
             row.Cells[5].Value = item.amt.ToString("F2");
             row.Cells[6].Value = item.approve_flag_str;
             row.Cells[7].Value = item.oper_date.ToString("yyyy-MM-dd HH:mm:ss");
             if (item.is_give == "1")
             {
                 row.Cells[5].Style.Font = new Font("SimSun", 11F, FontStyle.Strikeout);
             }
         }
         int n = pageIndex;
         int m = (int)Math.Ceiling((decimal)this.total / (decimal)this.pageSize);
         this.pageCount   = m;
         this.Label1.Text = string.Format("第{0}页,共{1}页", n.ToString(), m.ToString());
     }
     catch (Exception e)
     {
         new MsgForm(e.Message).ShowDialog();
     }
     finally
     {
         System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
     }
 }
Ejemplo n.º 10
0
        private void pnl_search_Click(object sender, EventArgs e)
        {
            pnlboard.Visible = false;

            IBLL.ISaleData bll         = new BLL.SaleData();
            int            order_count = 0;
            decimal        total_amt   = 0;
            decimal        fact_amt    = 0;

            bll.GetInOutSheetSum(pnldate1.Text, pnldate2.Text, out order_count, out total_amt, out fact_amt);
            lbl_order_count.Text = order_count.ToString();
            lbl_total_amt.Text   = total_amt.ToString("F2");
            lbl_fact_amt.Text    = fact_amt.ToString("F2");
            this.pnl_first_Click(pnl_first, null);
        }
Ejemplo n.º 11
0
        public CusBalanceForm(string cust_id)
        {
            InitializeComponent();

            IBLL.IClientBLL bll        = new BLL.ClientBLL();
            decimal         bal_amt    = 0;
            decimal         credit_amt = 0;

            bll.GetCusBalance(cust_id, out bal_amt, out credit_amt);

            IBLL.ISaleData bll2   = new BLL.SaleData();
            decimal        no_pay = bll2.GetCusNoPayAmt(cust_id);

            lbl_bal_amt.Text    = (bal_amt - no_pay).ToString("F2");
            lbl_credit_amt.Text = credit_amt.ToString("F2");
            lbl_use_amt.Text    = (credit_amt + (bal_amt - no_pay)).ToString("F2");
        }
Ejemplo n.º 12
0
        private void btn_give_Click(object sender, EventArgs e)
        {
            var row = dataGridView1.CurrentRow;

            if (row != null && row.Tag != null && row.Tag.ToString() != "")
            {
                if (Program.oper_type != "1000")
                {
                    //new MsgForm("当前用户不属于[系统管理员]组").ShowDialog();
                    return;
                }
                int flow_id = Conv.ToInt(row.Tag);
                var line    = this.lines.FirstOrDefault(d => d.flow_id == flow_id);

                IBLL.ISaleData bll = new BLL.SaleData();
                bll.GiveSaleFlow(line.sheet_no, flow_id, Program.oper_id);
                line.is_give = "1";
                line.price   = 0;
                line.amt     = 0;
                this.ShowLine();
            }
        }
Ejemplo n.º 13
0
        private void ShowSelectedGoods()
        {
            if (currGoods != null)
            {
                IBLL.ISaleData bll = new BLL.SaleData();
                if (supcus_no != "")
                {
                    lbl_price.Text = bll.GetSupItemPrice(supcus_no, currGoods.item_no).ToString("F2"); //供应商进价
                }
                else
                {
                    lbl_price.Text = currGoods.price.ToString("F2");//进价
                }

                lblgoods.Text = currGoods.item_name;

                //自动取重模式:称重商品将自动取重
                if (Program.weight_model == "2" && currGoods.item_flag == "1")
                {
                    inputQty("取重");
                }
            }
        }
Ejemplo n.º 14
0
        private void btn_reprint_Click(object sender, EventArgs e)
        {
            var c_row = dataGridView1.CurrentRow;

            if (c_row != null && c_row.Tag != null && c_row.Tag.ToString() != "")
            {
                var sheet_no = c_row.Tag.ToString();
                //准备打印表格
                DataTable dt = new DataTable();
                dt.Columns.Add("行号");
                dt.Columns.Add("销售单号");
                dt.Columns.Add("客户");
                dt.Columns.Add("操作员");
                dt.Columns.Add("日期");
                dt.Columns.Add("货号");
                dt.Columns.Add("商品名称");
                dt.Columns.Add("规格");
                dt.Columns.Add("单位");
                dt.Columns.Add("数量");
                dt.Columns.Add("单价");
                dt.Columns.Add("金额");
                dt.Columns.Add("合计数量");
                dt.Columns.Add("合计金额");
                dt.Columns.Add("付款方式");
                dt.Columns.Add("实付金额");
                dt.Columns.Add("抹零金额");
                dt.Columns.Add("整单折扣");

                IBLL.ISaleData bll   = new BLL.SaleData();
                DataTable      lines = new DataTable();
                decimal        ml    = 0;
                var            ord   = bll.GetSaleSheetMasterDetail(sheet_no, out lines, out ml);
                decimal        amt   = 0; //单据总金额
                decimal        qty   = 0; //单据总数量
                int            index = 0;
                if (ord != null && lines.Rows.Count > 0)
                {
                    string pay_way_str = "挂账/预付";
                    if (ord.pay_way == "A")
                    {
                        pay_way_str = "现结-现金";
                    }
                    else if (ord.pay_way == "W")
                    {
                        pay_way_str = "现结-微信";
                    }
                    else if (ord.pay_way == "Z")
                    {
                        pay_way_str = "现结-支付宝";
                    }

                    foreach (DataRow dr in lines.Rows)
                    {
                        ++index;
                        //待打印表单处理
                        DataRow row = dt.NewRow();
                        row["行号"]   = index.ToString();
                        row["销售单号"] = ord.sheet_no;
                        row["客户"]   = ord.cust_no;
                        row["操作员"]  = ord.oper_id;
                        row["日期"]   = ord.oper_date.ToString("yyyy-MM-dd");
                        row["货号"]   = dr["item_subno"].ToString();
                        row["商品名称"] = dr["item_name"].ToString();
                        row["规格"]   = dr["item_size"].ToString();
                        row["单位"]   = dr["unit_no"].ToString();
                        row["数量"]   = Conv.ToDecimal(dr["sale_qnty"]).ToString("F2");
                        row["单价"]   = Conv.ToDecimal(dr["real_price"]).ToString("F2");
                        row["金额"]   = Conv.ToDecimal(dr["sale_money"]).ToString("F2");
                        row["付款方式"] = pay_way_str;
                        row["实付金额"] = ord.real_amount.ToString("F2");
                        row["抹零金额"] = ml.ToString("F2");
                        if (ord.discount != 0)
                        {
                            row["整单折扣"] = (ord.discount * 100) + "折";
                        }
                        else
                        {
                            row["整单折扣"] = "无折扣";
                        }
                        dt.Rows.Add(row);
                        amt += Conv.ToDecimal(dr["sale_money"]);
                        qty += Conv.ToDecimal(dr["sale_qnty"]);
                    }
                    foreach (DataRow row in dt.Rows)
                    {
                        row["合计数量"] = qty.ToString("F2");
                        row["合计金额"] = amt.ToString("F2");
                    }
                }
                //打印
                try
                {
                    IBLL.ISysBLL sbll = new BLL.SysBLL();
                    sbll.WritePrintLog(ord.sheet_no);
                    printXSCK printXsck = new printXSCK(dt);
                    printXsck.print();
                }
                catch (Exception ex)
                {
                    Log.writeLog("btn_reprint_Click()", ex.ToString(), sheet_no);
                }
            }
        }
Ejemplo n.º 15
0
        //取重、输入数量
        private void inputQty(string text)
        {
            if (supcus_no == "")
            {
                new MsgForm("未选择客户").ShowDialog();
                return;
            }
            if (currGoods != null)
            {
                if (Program.is_continue_weight == "1" && total_weight == Weight)
                {
                    new MsgForm("请先放商品,再取重").ShowDialog();
                    return;
                }
                IBLL.ISaleData       bll      = new BLL.SaleData();
                IBLL.IGoods          goodsBLL = new BLL.Goods();
                Model.bi_t_item_info gd       = currGoods;
                Model.t_order_detail item     = new Model.t_order_detail();
                item.item_no = gd.item_no;
                switch (text)
                {
                case "取重":
                    if (Program.is_continue_weight == "1" && total_weight != 0)
                    {
                        item.qty = Weight - total_weight;
                    }
                    else
                    {
                        item.qty = Weight;
                    }
                    break;

                case "手输数量":
                    if (Program.can_input_qty == "1" && currGoods.item_flag == "1")
                    {
                        new MsgForm("称重商品不可手输数量").ShowDialog();
                        return;
                    }
                    InputNumerForm frm = new InputNumerForm("数量", 3);
                    decimal        qty = 0;
                    if (frm.Input(out qty) == true)
                    {
                        if (qty <= 0)
                        {
                            new MsgForm("数量不正确").ShowDialog();
                            return;
                        }
                        item.qty = qty;
                    }
                    else
                    {
                        return;
                    }

                    break;
                }
                if (bll.CheckCusIsRetail(supcus_no))
                {
                    item.price = currGoods.base_price;//一级批发价
                }
                else
                {
                    IBLL.IClientBLL bll2 = new BLL.ClientBLL();
                    item.price = bll2.GetCusItemPrice(supcus_no, item.item_no); //在线取客户零批价
                }
                total_weight = Weight;

                item.item_subno   = gd.item_subno;
                item.item_name    = gd.item_name;
                item.unit_no      = gd.unit_no;
                item.amt          = item.qty * item.price;
                item.sheet_no     = lblsheet_no.Text;
                item.oper_id      = Program.oper_id;
                item.oper_date    = DateTime.Now;
                item.jh           = Program.jh;
                item.cost_price   = goodsBLL.GetCost(gd.item_no, Program.branch_no);
                item.branch_no    = Program.branch_no;
                item.cus_no       = supcus_no;
                item.sup_no       = supcus_no;
                item.is_give      = "0";
                item.source_price = item.price;
                item.discount     = 1;

                int flow_id = 0;
                bll.Insert(item, out flow_id);
                item.flow_id = flow_id;
                this.lines.Add(item);
                this.ShowLine();
            }
        }
Ejemplo n.º 16
0
        private void refreshData()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                IBLL.ISaleData bll         = new BLL.SaleData();
                int            order_count = 0;
                decimal        total_amt   = 0;
                decimal        give_amt    = 0;
                string         order_key   = "SO";
                if (radioButton2.Checked)
                {
                    order_key = "PI";
                }
                var lst = bll.GetSaleSum(pnldate1.Text, pnldate2.Text, order_key, out order_count, out total_amt, out give_amt);

                lbl_order_count.Text = order_count.ToString();
                lbl_total_amt.Text   = total_amt.ToString("F2");
                lbl_give_amt.Text    = give_amt.ToString("F2");
                decimal no_pay = total_amt;
                if (lst.Count > 0)
                {
                    var cash_amt = lst.Where(d => d.pay_way == "A").Sum(d => d.pay_amount);
                    var wx_amt   = lst.Where(d => d.pay_way == "W").Sum(d => d.pay_amount);
                    var zfb_amt  = lst.Where(d => d.pay_way == "Z").Sum(d => d.pay_amount);
                    var ml_amt   = lst.Where(d => d.pay_way == "Y").Sum(d => d.pay_amount);

                    lbl_cash_amt.Text = cash_amt.ToString("F2");
                    lbl_wx_amt.Text   = wx_amt.ToString("F2");
                    lbl_zfb_amt.Text  = zfb_amt.ToString("F2");
                    lbl_ml_amt.Text   = ml_amt.ToString("F2");
                    no_pay            = no_pay - cash_amt - wx_amt - zfb_amt - ml_amt;
                }
                lbl_no_pay.Text = no_pay.ToString("F2");

                if (order_key == "SO")
                {
                    order_count = 0;
                    total_amt   = 0;
                    give_amt    = 0;
                    var lst2 = bll.GetSaleSum(pnldate1.Text, pnldate2.Text, "RI", out order_count, out total_amt, out give_amt);

                    if (order_count > 0)
                    {
                        groupBox1.Visible = true;
                    }

                    lbl_th_order_count.Text = order_count.ToString();
                    lbl_th_total_amt.Text   = total_amt.ToString("F2");
                    if (lst2.Count > 0)
                    {
                        var cash_amt = lst2.Where(d => d.pay_way == "A").Sum(d => d.pay_amount);
                        var wx_amt   = lst2.Where(d => d.pay_way == "W").Sum(d => d.pay_amount);
                        var zfb_amt  = lst2.Where(d => d.pay_way == "Z").Sum(d => d.pay_amount);
                        var ml_amt   = lst2.Where(d => d.pay_way == "Y").Sum(d => d.pay_amount);

                        lbl_th_cash_amt.Text = cash_amt.ToString("F2");
                        lbl_th_wx_amt.Text   = wx_amt.ToString("F2");
                        lbl_th_zfb_amt.Text  = zfb_amt.ToString("F2");
                        lbl_th_ml_amt.Text   = ml_amt.ToString("F2");
                    }
                }
            }
            catch (Exception e)
            {
                var frm = new MsgForm(e.Message);
                frm.ShowDialog();
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }