Beispiel #1
0
        private void 全部数据清空ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("数据将全部被清除,建议先备份数据文件后再清除,是否备份?", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                导出数据文件ToolStripMenuItem_Click(null, null);
            }
            else if (result == DialogResult.No)
            {
                if (MessageBox.Show("现有数据将全部被清除,是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
                {
                    return;
                }
                else
                {
                    CustomerDao.getInstance().ClearAllArrear();
                    PayReceiptDao.getInstance().DeleteAll();
                    ProductStainlessCirculationDao.getInstance().DeleteAll();
                    SellProfitDao.getInstance().DeleteAll();
                    ProductStainlessDao.getInstance().ClearAllNumAndCost();
                    MessageBox.Show("删除清空数据成功,系统将自动关闭,请重新启动软件!", "提示", MessageBoxButtons.OK);
                    this.Close();
                }
            }
        }
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            int parentId = (int)e.Argument;

            payReceiptList = PayReceiptDao.getInstance().FindPayReceiptList(this.dateTimePicker_start.Value, this.dateTimePicker_end.Value.AddDays(1), 4, this.textBox_search.Text, parentId, 1);
            //这个地方需要再改成ProductCirculationDao
            productCirculationList = ProductStainlessCirculationDao.getInstance().FindProductCirculationList(1, 4, this.dateTimePicker_start.Value, this.dateTimePicker_end.Value.AddDays(1), 4, this.textBox_search.Text, parentId);
        }
Beispiel #3
0
 public override ProductCirculationForm getProductSellBackForm()
 {
     if (productSellBackForm == null || productSellBackForm.IsDisposed)
     {
         productSellBackForm = new ProductStainlessCirculationForm(ProductCirculation.CirculationTypeConf_SellBack, ProductStainlessCirculationDao.getInstance());
         appendEvent(productSellBackForm);
     }
     return(productSellBackForm);
 }
Beispiel #4
0
        /****************** sell ****************/
        public override ProductCirculationListForm getProductSellListForm()
        {
            if (productSellListForm == null || productSellListForm.IsDisposed)
            {
                productSellListForm = new ProductCirculationListForm(mainForm, 2, "销售单据列表", ProductStainlessCirculationDao.getInstance());
                productSellListForm.initVersions(getVersions(),
                                                 UpdateType.SellUpdate, UpdateType.SellFinishUpdate, UpdateType.CustomerUpdate);

                appendEvent(productSellListForm);
            }
            return(productSellListForm);
        }
Beispiel #5
0
 public override ProductCirculationForm getProductLibLossForm()
 {
     if (productLibLossForm == null || productLibLossForm.IsDisposed)
     {
         productLibLossForm = new ProductCirculationForm(ProductCirculation.CirculationTypeConf_LibLoss, ProductStainlessCirculationDao.getInstance());
         productLibLossForm.hideSomeControls();
         appendEvent(productLibLossForm);
     }
     return(productLibLossForm);
 }
Beispiel #6
0
        /************ lib *************/
        public override ProductCirculationListForm getProductLibListForm()
        {
            if (productLibListForm == null || productLibListForm.IsDisposed)
            {
                productLibListForm = new ProductCirculationListForm(mainForm, 3, "盘点单据列表", ProductStainlessCirculationDao.getInstance());
                productLibListForm.initVersions(getVersions(),
                                                UpdateType.LibUpdate, UpdateType.LibFinishUpdate);
                productLibListForm.hideControls();

                appendEvent(productLibListForm);
            }
            return(productLibListForm);
        }
        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;
                }
            }
        }
        /// <summary>
        /// for event
        /// </summary>
        ///
        protected void toolStripButton_save_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count <= 0)
            {
                MessageBox.Show("明细不能为空,请添加明细!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //added 2018-3-30
            this.refreshArrears();

            //for datagridview validate
            if (dataGridView1.Rows.Count > 0 && dataGridView1.Columns["totalPrice"].Visible == true)
            {
                dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells["totalPrice"];
            }

            List <ProductCirculationRecord> records;
            bool isRecordsCorrect = getRecords(out records);

            ProductCirculation circulation;
            bool isSellCorrect = getCirculation(out circulation);

            if (isRecordsCorrect == false || isSellCorrect == false)
            {
                return;
            }

            //
            if (this.openMode == 1 && cirDao.FindByID(circulation.ID) == null)
            {
                MessageBox.Show("该单据已经被删除了。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //this.Enabled = true;
                return;
            }

            try
            {
                if (openMode == 0)
                {
                    circulation.Status = 1;
                    cirDao.Insert(circulation, records, out circulationID);
                    MessageBox.Show(string.Format("增加{0}成功!", this.Text), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (openMode == 1)
                {
                    cirDao.UpdateBaiscInfo(circulation);
                    if (recordChanged)
                    {
                        cirDao.updateRecords(circulation.ID, records);
                    }
                    MessageBox.Show(string.Format("保存{0}成功!", this.Text), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                openMode = 1;
                //重新更新circulation和record,因为ID不一样
                this.initCirculation();
            }
            catch (Exception ex)
            {
                if (openMode == 0)
                {
                    ProductStainlessCirculationDao.getInstance().DeleteByID(circulationID);
                }
                MessageBox.Show("保存有误,可能是往来单位或货品属性被修改过,请重新编辑!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            //so important: if edit ,it should be refresh also, because edit will del exist item and add new item
            this.invokeUpdateNotify(conf.notifyType);
        }
Beispiel #9
0
 public override ProductCirculationForm getManuInForm()
 {
     if (manuInForm == null || manuInForm.IsDisposed)
     {
         manuInForm = new ProductStainlessCirculationForm(ProductCirculation.CirculationTypeConf_ManuIn, ProductStainlessCirculationDao.getInstance());
         appendEvent(manuInForm);
         manuInForm.hideSomeControls();
     }
     return(manuInForm);
 }
Beispiel #10
0
        /***************** manufacture ************************/
        public override ProductCirculationListForm getManufactureListForm()
        {
            if (manufactureListForm == null || manufactureListForm.IsDisposed)
            {
                manufactureListForm = new ProductCirculationListForm(mainForm, 4, "生产单据列表", ProductStainlessCirculationDao.getInstance());
                manufactureListForm.initVersions(getVersions(),
                                                 UpdateType.ManuUpdate, UpdateType.ManuFinishUpdate);

                manufactureListForm.hideControls();
                appendEvent(manufactureListForm);
            }
            return(manufactureListForm);
        }
Beispiel #11
0
        /************* purchase ******************/
        public override ProductCirculationListForm getProductPurchaseListForm()
        {
            if (productPurchaseListForm == null || productPurchaseListForm.IsDisposed)
            {
                productPurchaseListForm = new ProductCirculationListForm(mainForm, 1, "采购单据列表", ProductStainlessCirculationDao.getInstance());
                productPurchaseListForm.initVersions(getVersions(),
                                                     //表示如果这三个业务有更新,窗口也要刷新
                                                     UpdateType.PurchaseUpdate, UpdateType.PurchaseFinishUpdate, UpdateType.CustomerUpdate);

                appendEvent(productPurchaseListForm);
            }
            return(productPurchaseListForm);
        }
Beispiel #12
0
 public PayReceiptForm getSellRefundBillForm()
 {
     if (sellRefundBillForm == null || sellRefundBillForm.IsDisposed)
     {
         sellRefundBillForm = new PayReceiptForm(PayReceipt.PayReceiptTypeConf_SellRefund, ProductStainlessCirculationDao.getInstance());
         appendEvent(sellRefundBillForm);
     }
     return(sellRefundBillForm);
 }
Beispiel #13
0
 public PayReceiptForm getBuyPayBillForm()
 {
     if (buyPayBillForm == null || buyPayBillForm.IsDisposed)
     {
         //等进一步改造,把全部stainless、clothesDao的调用都放在一个地方
         buyPayBillForm = new PayReceiptForm(PayReceipt.PayReceiptTypeConf_BuyPay, ProductStainlessCirculationDao.getInstance());
         appendEvent(buyPayBillForm);
     }
     return(buyPayBillForm);
 }