コード例 #1
0
        private void load_with_customer(ProductCirculation sell, List <ProductCirculationRecord> records)
        {
            // 获取供应商的信息
            Customer customer = CustomerDao.getInstance().FindByID(sell.CustomerID);

            DataTable dt = ConfDao.getInstance().GetAll();

            Report.ControlByName("title").AsStaticBox.Text = ConfDao.getInstance().Get(3).ToString() + conf.name + "单";

            //Report.ControlByName("info").AsStaticBox.Text = string.Format("地    址 : {0}\n银行账号 : {1}\n其他信息 : {2}", dt.Rows[3]["conf"], dt.Rows[7]["conf"], dt.Rows[8]["conf"]);
            //Report.ControlByName("contract").AsStaticBox.Text = string.Format("联 系 人 : {0}\n电话号码 : {1}\n手机号码 : {2}", dt.Rows[4]["conf"], dt.Rows[5]["conf"], dt.Rows[6]["conf"]);

            if (Report.ControlByName("addressValue") != null)
            {
                Report.ControlByName("addressValue").AsStaticBox.Text = dt.Rows[3]["conf"].ToString();
            }

            if (Report.ControlByName("bankValue") != null)
            {
                Report.ControlByName("bankValue").AsStaticBox.Text = dt.Rows[7]["conf"].ToString();
            }

            if (Report.ControlByName("commentValue") != null)
            {
                Report.ControlByName("commentValue").AsStaticBox.Text = dt.Rows[8]["conf"].ToString();
            }

            if (Report.ControlByName("contractorValue") != null)
            {
                Report.ControlByName("contractorValue").AsStaticBox.Text = dt.Rows[4]["conf"].ToString();
            }

            if (Report.ControlByName("telValue") != null)
            {
                Report.ControlByName("telValue").AsStaticBox.Text = dt.Rows[5]["conf"].ToString();
            }

            if (Report.ControlByName("phoneValue") != null)
            {
                Report.ControlByName("phoneValue").AsStaticBox.Text = dt.Rows[6]["conf"].ToString();
            }

            string filePath = Application.StartupPath + ConfUtility.debugPath + "\\" + ConfDao.getInstance().Get(14);

            if (Report.ControlByName("PictureBox1") != null && File.Exists(filePath))
            {
                Report.ControlByName("PictureBox1").AsPictureBox.LoadFromFile(filePath);
            }

            // (用户,供应商)
            Report.ControlByName("customer").AsStaticBox.Text = string.Format("{0}{1}{2}", conf.customer, sell.CustomerName, String.IsNullOrEmpty(customer.Phone) ? "" : "(手机:" + customer.Phone + ")");

            if (Report.ControlByName("customerAddr") != null)
            {
                Report.ControlByName("customerAddr").AsStaticBox.Text = "客户地址: " + customer.Address;
            }

            // (日期)
            Report.ControlByName("date").AsStaticBox.Text = "开单时间: " + sell.CirculationTime.ToString("yyyy年MM月dd日");

            // 右(单号)
            if (Report.ControlByName("serial") != null)
            {
                Report.ControlByName("serial").AsStaticBox.Text = "单号: NO." + sell.Code;
            }

            // 备注
            if (Report.ControlByName("cirComment") != null)
            {
                Report.ControlByName("cirComment").AsStaticBox.Text = string.Format("备注:{0}", sell.Comment);
            }

            Report.ControlByName("realTotal").AsStaticBox.Text = string.Format("{0:0.00}元", sell.RealTotal);
            if (Report.ControlByName("text_backFreight") != null)
            {
                Report.ControlByName("text_backFreight").AsStaticBox.Text = string.Format("{0}件×{1}元 = {2}元", this.label_totalPieces.Text, this.textBox_backFreightPerPiece.Text, this.label_totalBackFreight.Text);
            }

            if (ConfUtility.GetLastPayReceiptOpen() == "lastPayReceiptOpen" && Report.ControlByName("lastPayReceipt") != null)
            {
                Report.ControlByName("lastPayReceipt").AsStaticBox.Text = this.label_lastPayReceipt.Text;
            }

            Report.ControlByName("label_pay").AsStaticBox.Text = this.label_thisPayed.Text;

            Report.ControlByName("text_pay").AsStaticBox.Text = string.Format("{0:0.00}元", double.Parse(this.textBox_thisPayed.Text));
            Report.ControlByName("text_arr").AsStaticBox.Text = string.Format("{0:0.00}元", double.Parse(this.textBox_previousArrears.Text));
            Report.ControlByName("text_acc").AsStaticBox.Text = string.Format("{0:0.00}元 ({1})", this.textBox_accumulative.Text, this.label_accCap.Text);
            //因为有些单据是没有的
            if (Report.ControlByName("oper") != null)
            {
                Report.ControlByName("oper").AsStaticBox.Text = sell.Oper;
            }

            fill_records(records);
        }
コード例 #2
0
        private void setLastPayReceipt(int customerId)
        {
            ProductCirculation cir            = cirDao.FindLastestByCustomerID(customerId, true);
            PayReceipt         payReceipt     = PayReceiptDao.getInstance().FindLastestByCustomerID(customerId, true);
            double             lastPayReceipt = 0;
            int      cashDirection            = 0;
            DateTime dt = DateTime.Now;

            if (cir != null && payReceipt != null)
            {
                if (cir.CirculationTime < payReceipt.bill_time)
                {
                    lastPayReceipt = payReceipt.thisPayed;
                    cashDirection  = payReceipt.cashDirection;
                    dt             = payReceipt.bill_time;
                }
                else
                {
                    lastPayReceipt = cir.ThisPayed;
                    cashDirection  = cir.FlowType * -1;
                    dt             = cir.CirculationTime;
                }
            }
            else if (cir != null && payReceipt == null)
            {
                lastPayReceipt = cir.ThisPayed;
                cashDirection  = cir.FlowType * -1;
                dt             = cir.CirculationTime;
            }
            else if (cir == null && payReceipt != null)
            {
                lastPayReceipt = payReceipt.thisPayed;
                cashDirection  = payReceipt.cashDirection;
                dt             = payReceipt.bill_time;
            }

            if (lastPayReceipt == 0 || cashDirection == 0)
            {
                label_lastPayReceipt.Text = "";
            }
            else
            {
                label_lastPayReceipt.Text = string.Format("{0}{1:0.00}元({2:yyyy/MM/dd})", cashDirection == -1 ? LabelUtility.LAST_PAY : LabelUtility.LAST_RECEIPT, lastPayReceipt, dt);
            }

            Customer customer = CustomerDao.getInstance().FindByID(customerId);

            if (customer.arrear < 0)
            {
                ProductCirculation lastCir = cirDao.FindLastestAccReceiptZero(customerId);
                PayReceipt         lastPay = PayReceiptDao.getInstance().FindLastestAccReceiptZero(customerId);
                DateTime           lastDt;
                if (lastCir != null && lastPay != null)
                {
                    lastDt = lastCir.CirculationTime.CompareTo(lastPay.bill_time) < 0 ? lastCir.CirculationTime : lastPay.bill_time;
                }
                else if (lastCir == null && lastPay != null)
                {
                    lastDt = lastPay.bill_time;
                }
                else if (lastCir != null && lastPay == null)
                {
                    lastDt = lastCir.CirculationTime;
                }
                else
                {
                    return;
                }


                TimeSpan ts = DateTime.Now.Subtract(lastDt);
                label_lastPayReceipt.Text += string.Format("欠款{0}天", ts.Days);
            }
        }