Exemplo n.º 1
0
        public PayReceiptTypeConf(PayReceipt.BillType type, UpdateType notifyType, UpdateType finishNotifyType, int arrearDirection, int cashDirection, string name, string code, string customer, string business)
        {
            this.type             = type;
            this.notifyType       = notifyType;
            this.finishNotifyType = finishNotifyType;

            this.arrearDirection = arrearDirection;
            this.cashDirection   = cashDirection;

            this.name   = name;
            this.serial = code;

            this.customer = customer;
            this.business = business;
        }
Exemplo n.º 2
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            receipt = purchaseBack = otherReceipt = 0;
            payed   = sellBack = freights = otherPay = 0;

            payReceiptList  = PayReceiptDao.getInstance().FindPayReceiptList(null, null, 4, null, -1, 1);
            circulationList = ProductStainlessCirculationDao.getInstance().FindProductCirculationList(1, 4, null, null, 4, null, -1);

            foreach (ProductCirculation cir in circulationList)
            {
                int type = cir.Type;
                if (type == 1)
                {
                    payed += cir.ThisPayed;
                }
                else if (type == 2)
                {
                    purchaseBack += cir.ThisPayed;
                }
                else if (type == 3)
                {
                    receipt += cir.ThisPayed;
                }
                else if (type == 4)
                {
                    sellBack += cir.ThisPayed;
                }

                freights += cir.Freight;
            }

            foreach (PayReceipt pr in payReceiptList)
            {
                PayReceipt.BillType type = pr.bill_type;
                switch (type)
                {
                case PayReceipt.BillType.BuyPay:
                    payed += pr.thisPayed;
                    break;

                case PayReceipt.BillType.BuyRefund:
                    purchaseBack += pr.thisPayed;
                    break;

                case PayReceipt.BillType.SellReceipt:
                    receipt += pr.thisPayed;
                    break;

                case PayReceipt.BillType.SellRefund:
                    sellBack += pr.thisPayed;
                    break;

                case PayReceipt.BillType.OtherPay:
                    otherPay += pr.thisPayed;
                    break;

                case PayReceipt.BillType.OtherReceipt:
                    otherReceipt += pr.thisPayed;
                    break;

                default:
                    break;
                }
            }

            lib       = 0;
            productDT = ProductStainlessDao.getInstance().FindList(null, null, true);
            foreach (DataRow dr in productDT.Rows)
            {
                double price;
                int    num;
                bool   positive;

                ValidateUtility.getInt(dr, "num", out num, out positive);
                ValidateUtility.getDouble(dr, "priceCost", out price);
                //这里如果直接取ProductStainless就不需要判断
                if (price <= 0)
                {
                    ValidateUtility.getDouble(dr, "pricePurchase", out price);
                }

                lib = lib + price * num;
            }

            needPay    = needReceipt = 0;
            customerDT = CustomerDao.getInstance().FindList(null, null);

            foreach (DataRow dr in customerDT.Rows)
            {
                double arrear = 0;
                ValidateUtility.getDouble(dr, "arrear", out arrear);
                if (arrear > 0)
                {
                    needPay += arrear;
                }
                else
                {
                    needReceipt -= arrear;
                }
            }
        }