Ejemplo n.º 1
0
 private void calEffect(IList <Model.AcPaymentDetail> acPaymentDetail)
 {
     foreach (Model.AcPaymentDetail item in acPaymentDetail)
     {
         if (String.IsNullOrEmpty(item.AcInvoiceId))
         {
             continue;
         }
         if (item.AcInvoiceType == "採購發票單")
         {
             Model.AcInvoiceCOBill cobill = acInvoiceCOBillaccessor.Get(item.AcInvoiceId);
             if (cobill == null)
             {
                 continue;
             }
             cobill.mHeXiaoJingE  = cobill.mHeXiaoJingE == null ? 0 : cobill.mHeXiaoJingE - item.DomesticThisChargeMoney;
             cobill.NoHeXiaoTotal = cobill.ZongMoney - cobill.mHeXiaoJingE;
             acInvoiceCOBillaccessor.Update(cobill);
         }
         else if (item.AcInvoiceType == "其它應付款")
         {
             Model.AcOtherShouldPayment acoSP = acOtherShouldPaymentAccessor.Get(item.AcInvoiceId);
             if (acoSP == null)
             {
                 continue;
             }
             acoSP.mHeXiaoJingE  = acoSP.mHeXiaoJingE == null ? 0 : acoSP.mHeXiaoJingE - item.DomesticThisChargeMoney;
             acoSP.NoHeXiaoTotal = acoSP.HeJi - acoSP.mHeXiaoJingE;
             acOtherShouldPaymentAccessor.Update(acoSP);
         }
     }
 }
Ejemplo n.º 2
0
        private void addDetail(Model.AcPayment acPayment)
        {
            foreach (Model.AcPaymentDetail item in acPayment.Detail)
            {
                if (String.IsNullOrEmpty(item.AcInvoiceId))
                {
                    continue;
                }
                item.AcPaymentId = acPayment.AcPaymentId;
                if (item.AcInvoiceType == "採購發票單")
                {
                    Model.AcInvoiceCOBill cobill = acInvoiceCOBillaccessor.Get(item.AcInvoiceId);
                    if (cobill == null)
                    {
                        goto mustdo;
                    }
                    cobill.mHeXiaoJingE  = cobill.mHeXiaoJingE == null ? 0 : cobill.mHeXiaoJingE + item.DomesticThisChargeMoney;
                    cobill.NoHeXiaoTotal = cobill.ZongMoney - cobill.mHeXiaoJingE;
                    acInvoiceCOBillaccessor.Update(cobill);
                }
                else if (item.AcInvoiceType == "其它應付款")
                {
                    Model.AcOtherShouldPayment acoSP = acOtherShouldPaymentAccessor.Get(item.AcInvoiceId);
                    if (acoSP == null)
                    {
                        goto mustdo;
                    }
                    acoSP.mHeXiaoJingE  = acoSP.mHeXiaoJingE == null ? 0 : acoSP.mHeXiaoJingE + item.DomesticThisChargeMoney;
                    acoSP.NoHeXiaoTotal = acoSP.HeJi - acoSP.mHeXiaoJingE;
                    acOtherShouldPaymentAccessor.Update(acoSP);
                }
mustdo:
                acPaymentDetailaccessor.Insert(item);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 尾笔
 /// </summary>
 protected override void MoveLast()
 {
     // if (_acbeginAccountPayble == null)
     {
         this._acInvoiceCoBill = this._acInvoiceCoBillManager.Get(this._acInvoiceCoBillManager.GetLast() == null ? "" : this._acInvoiceCoBillManager.GetLast().AcInvoiceCOBillId);
     }
 }
Ejemplo n.º 4
0
        public bool ExistsExcept(Model.AcInvoiceCOBill e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.AcInvoiceCOBillId) == null?null:Get(e.AcInvoiceCOBillId).Id);
            return(sqlmapper.QueryForObject <bool>("AcInvoiceCOBill.existsexcept", paras));
        }
Ejemplo n.º 5
0
 protected override void MoveNext()
 {
     Model.AcInvoiceCOBill temp = this._acInvoiceCoBillManager.GetNext(this._acInvoiceCoBill);
     if (temp == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._acInvoiceCoBill = this._acInvoiceCoBillManager.Get(temp.AcInvoiceCOBillId);
 }
 public Model.AcInvoiceCOBill GetDetails(Model.AcInvoiceCOBill acInvoiceCoBill)
 {
     Model.AcInvoiceCOBill temp = accessor.Get(acInvoiceCoBill.AcInvoiceCOBillId);
     if (temp != null)
     {
         temp.Details = accessorDetails.SelectByAcInvoiceCOBill(temp);
     }
     return(temp);
 }
        public void _Update(Model.AcInvoiceCOBill acInvoiceCOBill)
        {
            acInvoiceCOBill.UpdateTime = DateTime.Now;
            accessor.Update(acInvoiceCOBill);
            IList <Model.AcInvoiceCOBillDetail> olddetail = accessorDetails.SelectByAcInvoiceCOBill(acInvoiceCOBill);

            calEffect(olddetail);
            accessorDetails.Delete(acInvoiceCOBill);
            addDetail(acInvoiceCOBill);
        }
Ejemplo n.º 8
0
 protected override void AddNew()
 {
     this._acInvoiceCoBill = new Model.AcInvoiceCOBill();
     this._acInvoiceCoBill.AcInvoiceCOBillId = this._acInvoiceCoBillManager.GetId();
     //this._acInvoiceCoBill.Id = this._acInvoiceCoBillManager.GetId();
     this._acInvoiceCoBill.AcInvoiceCOBillDate = DateTime.Now;
     this._acInvoiceCoBill.Employee            = BL.V.ActiveOperator.Employee;
     this._acInvoiceCoBill.TaxRateType         = 1;
     this._acInvoiceCoBill.TaxRate             = 5;
     this._acInvoiceCoBill.Details             = new List <Model.AcInvoiceCOBillDetail>();
 }
Ejemplo n.º 9
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ListForm lf = new ListForm();

            if (lf.ShowDialog(this) == DialogResult.OK)
            {
                this._acInvoiceCoBill = (Model.AcInvoiceCOBill)lf.SelectItem;
                this.action           = "view";
                this.Refresh();
            }
            lf.Dispose();
            GC.Collect();
        }
Ejemplo n.º 10
0
        public override void Refresh()
        {
            if (this._acInvoiceCoBill == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._acInvoiceCoBill = this._acInvoiceCoBillManager.GetDetails(this._acInvoiceCoBill);
                }
            }

            this.AcInvoiceCOBillId.Text         = this._acInvoiceCoBill.AcInvoiceCOBillId;
            this.textId.Text                    = this._acInvoiceCoBill.Id;
            this.HeJiMoney.Value                = this._acInvoiceCoBill.HeJiMoney == null ? 0 : this._acInvoiceCoBill.HeJiMoney.Value;
            this.calcTaxRate.Value              = this._acInvoiceCoBill.TaxRate == null ? 0 : Convert.ToDecimal(this._acInvoiceCoBill.TaxRate.Value);
            this.calcmHeXiaoJingE.Value         = this._acInvoiceCoBill.mHeXiaoJingE == null ? 0 : this.calcmHeXiaoJingE.Value;
            this.calcNoHeXiaoTotal.Value        = this._acInvoiceCoBill.NoHeXiaoTotal == null ? 0 : this.calcNoHeXiaoTotal.Value;
            this.TaxType.SelectedIndex          = Convert.ToInt32(this._acInvoiceCoBill.TaxRateType);
            this.TaxRateMoney.Value             = this._acInvoiceCoBill.TaxRateMoney == null ? 0 : this._acInvoiceCoBill.TaxRateMoney.Value;
            this.ZongMoney.Value                = this._acInvoiceCoBill.ZongMoney == null ? 0 : this._acInvoiceCoBill.ZongMoney.Value;
            this.newChooseEmployee0Id.EditValue = this._acInvoiceCoBill.AuditEmp;
            // this.newChooseEmployee1Id.EditValue = this._acInvoiceCoBill.Employee1;
            this.newChooseEmployeeId.EditValue     = this._acInvoiceCoBill.Employee;
            this.newChooseSup_SupplierId.EditValue = this._acInvoiceCoBill.Sup_Supplier;
            this.newChooseSupplierId.EditValue     = this._acInvoiceCoBill.Supplier;
            this.memoAcInvoiceCOBillDesc.Text      = this._acInvoiceCoBill.AcInvoiceCOBillDesc;
            this.dateAcInvoiceCOBillDate.DateTime  = this._acInvoiceCoBill.AcInvoiceCOBillDate.Value;
            this.txt_AuditState.EditValue          = this.GetAuditName(this._acInvoiceCoBill.AuditState);
            this.bindingSourceDetails.DataSource   = this._acInvoiceCoBill.Details;

            base.Refresh();
            //if (this.action == "view")
            //{
            //    this.barBtnJinHuoDan.Enabled = false;
            //}
            //else
            //{
            //    this.barBtnJinHuoDan.Enabled = true;
            //}
            this.newChooseEmployeeId.Enabled = false;
            //this.HeJiMoney.Enabled = false;
            this.ZongMoney.Enabled         = false;
            this.TaxRateMoney.Enabled      = false;
            this.calcmHeXiaoJingE.Enabled  = false;
            this.calcNoHeXiaoTotal.Enabled = false;
        }
Ejemplo n.º 11
0
 private void Validate(Model.AcInvoiceCOBill acInvoiceCOBill)
 {
     if (string.IsNullOrEmpty(acInvoiceCOBill.Id))
     {
         throw new global::Helper.RequireValueException(Model.AcInvoiceCOBill.PRO_Id);
     }
     if (string.IsNullOrEmpty(acInvoiceCOBill.SupplierId))
     {
         throw new global::Helper.RequireValueException(Model.AcInvoiceCOBill.PRO_SupplierId);
     }
     if (acInvoiceCOBill.Details == null || acInvoiceCOBill.Details.Count == 0)
     {
         throw new global::Helper.RequireValueException("AcInvoiceCOBill.Details");
     }
 }
Ejemplo n.º 12
0
 private void addDetail(Model.AcInvoiceCOBill acInvoiceCOBill)
 {
     foreach (Model.AcInvoiceCOBillDetail item in acInvoiceCOBill.Details)
     {
         item.AcInvoiceCOBillId = acInvoiceCOBill.AcInvoiceCOBillId;
         accessorDetails.Insert(item);
         //更新进货详细
         Model.InvoiceCGDetail icgd = mInvoiceCGDetailAccessor.Get(item.InvoiceCGDetailId);
         if (icgd != null)
         {
             icgd.InvoiceCGDetailFPQuantity = Convert.ToDouble(icgd.InvoiceCGDetailFPQuantity) + Convert.ToDouble(item.InvoiceCGDetaiInQuantity);
         }
         mInvoiceCGDetailAccessor.Update(icgd);
     }
 }
Ejemplo n.º 13
0
 public void Update(Model.AcInvoiceCOBill acInvoiceCOBill)
 {
     Validate(acInvoiceCOBill);
     try
     {
         BL.V.BeginTransaction();
         _Update(acInvoiceCOBill);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Insert a AcInvoiceCOBill.
        /// </summary>
        public void Insert(Model.AcInvoiceCOBill acInvoiceCOBill)
        {
            Validate(acInvoiceCOBill);

            try
            {
                acInvoiceCOBill.InsertTime = DateTime.Now;
                TiGuiExists(acInvoiceCOBill);


                acInvoiceCOBill.UpdateTime = DateTime.Now;

                BL.V.BeginTransaction();

                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, acInvoiceCOBill.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, acInvoiceCOBill.InsertTime.Value.Year, acInvoiceCOBill.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, acInvoiceCOBill.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);

                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                accessor.Insert(acInvoiceCOBill);

                foreach (Model.AcInvoiceCOBillDetail item in acInvoiceCOBill.Details)
                {
                    item.AcInvoiceCOBillId = acInvoiceCOBill.AcInvoiceCOBillId;
                    accessorDetails.Insert(item);
                    //更新进货详细
                    Model.InvoiceCGDetail icgd = mInvoiceCGDetailAccessor.Get(item.InvoiceCGDetailId);
                    if (icgd != null)
                    {
                        icgd.InvoiceCGDetailFPQuantity = Convert.ToDouble(icgd.InvoiceCGDetailFPQuantity) + Convert.ToDouble(item.InvoiceCGDetaiInQuantity);
                    }
                    mInvoiceCGDetailAccessor.Update(icgd);
                }
                BL.V.CommitTransaction();
            }
            finally
            {
                BL.V.RollbackTransaction();
            }
        }
Ejemplo n.º 15
0
        public void Delete(Model.AcInvoiceCOBill acInvoiceCOBill)
        {
            try
            {
                BL.V.BeginTransaction();
                calEffect(acInvoiceCOBill.Details);
                accessorDetails.Delete(acInvoiceCOBill);
                this.Delete(acInvoiceCOBill.AcInvoiceCOBillId);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Ejemplo n.º 16
0
 private void TiGuiExists(Model.AcInvoiceCOBill model)
 {
     if (this.ExistsPrimary(model.AcInvoiceCOBillId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.AcInvoiceCOBillId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
Ejemplo n.º 17
0
 protected override void Delete()
 {
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     try
     {
         this._acInvoiceCoBillManager.Delete(this._acInvoiceCoBill);
         this._acInvoiceCoBill = this._acInvoiceCoBillManager.GetNext(this._acInvoiceCoBill);
         if (this._acInvoiceCoBill == null)
         {
             this._acInvoiceCoBill = this._acInvoiceCoBillManager.GetLast();
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 18
0
 public Ro(Model.AcInvoiceCOBill acInvoiceCOBill)
 {
     InitializeComponent();
     //报表标题
     this.ReportName.Text = BL.Settings.CompanyChineseName;
     //报表标题
     this.ReportTitle.Text = Properties.Resources.AcInvoiceCOBill;
     //列印日期
     this.ReportDate.Text += System.DateTime.Now.ToShortDateString();
     //头资料
     this.Id.Text = acInvoiceCOBill.Id;
     this.AcInvoiceCOBillId.Text   = acInvoiceCOBill.AcInvoiceCOBillId;
     this.AcInvoiceCOBillDate.Text = acInvoiceCOBill.AcInvoiceCOBillDate.Value.ToString("yyyy-MM-dd");
     this.AcInvoiceCOBillDesc.Text = acInvoiceCOBill.AcInvoiceCOBillDesc;
     this.Employee.Text            = string.IsNullOrEmpty(acInvoiceCOBill.EmployeeId) ? "" : acInvoiceCOBill.Employee.ToString();
     this.Employee0.Text           = string.IsNullOrEmpty(acInvoiceCOBill.Employee1Id) ? "" : acInvoiceCOBill.Employee1.ToString();
     this.Employee1.Text           = string.IsNullOrEmpty(acInvoiceCOBill.Employee0Id) ? "" : acInvoiceCOBill.Employee0.ToString();
     this.Supplier.Text            = acInvoiceCOBill.Supplier.ToString();
     this.Sup_Supplier.Text        = string.IsNullOrEmpty(acInvoiceCOBill.Sup_SupplierId) ? "" : acInvoiceCOBill.Sup_Supplier.ToString();
     this.TaxRate.Text             = acInvoiceCOBill.TaxRate.ToString();
     this.TaxRateType.Text         = acInvoiceCOBill.TaxRateType.ToString();
     this.TaxRateMoney.Text        = acInvoiceCOBill.TaxRateMoney.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
     this.ZongMoney.Text           = acInvoiceCOBill.ZongMoney.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
     this.lblmHeXiaoJingE.Text     = acInvoiceCOBill.mHeXiaoJingE.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
     this.lblNoHeXiaoTotal.Text    = acInvoiceCOBill.NoHeXiaoTotal.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
     //绑定详细数据源
     this.DataSource = acInvoiceCOBill.Details;
     //详细资料
     this.CellInvoiceId.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceId);
     this.CellInvoiceAllowance.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceAllowance);
     this.CellProduct.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
     this.CellInvoiceCGDetaiInQuantity.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceCGDetaiInQuantity);
     this.CellInvoiceCGDetailMoney.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceCGDetailMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
     this.CellInvoiceCGDetailPrice.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceCGDetailPrice, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSDJXiao.Value));
     this.CellInvoiceCGDetailTax.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceCGDetailTax);
     this.CellInvoiceCGDetailTaxMoney.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceCGDetailTaxMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
     this.CellInvoiceCGDetailTaxPrice.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceCOBillDetail.PRO_InvoiceCGDetailTaxPrice, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSDJXiao.Value));
 }
Ejemplo n.º 19
0
 public void Insert(Model.AcInvoiceCOBill e)
 {
     this.Insert <Model.AcInvoiceCOBill>(e);
 }
Ejemplo n.º 20
0
 public Model.AcInvoiceCOBill GetNext(Model.AcInvoiceCOBill e)
 {
     return(sqlmapper.QueryForObject <Model.AcInvoiceCOBill>("AcInvoiceCOBill.get_next", e));
 }
Ejemplo n.º 21
0
 public Model.AcInvoiceCOBill GetPrev(Model.AcInvoiceCOBill e)
 {
     return(sqlmapper.QueryForObject <Model.AcInvoiceCOBill>("AcInvoiceCOBill.get_prev", e));
 }
Ejemplo n.º 22
0
 public bool HasRowsAfter(Model.AcInvoiceCOBill e)
 {
     return(sqlmapper.QueryForObject <bool>("AcInvoiceCOBill.has_rows_after", e));
 }
Ejemplo n.º 23
0
 public bool HasRowsBefore(Model.AcInvoiceCOBill e)
 {
     return(sqlmapper.QueryForObject <bool>("AcInvoiceCOBill.has_rows_before", e));
 }
Ejemplo n.º 24
0
 public IList <Model.AcInvoiceCOBillDetail> SelectByAcInvoiceCOBill(Model.AcInvoiceCOBill acInvoiceCoBill)
 {
     return(sqlmapper.QueryForList <Model.AcInvoiceCOBillDetail>("AcInvoiceCOBillDetail.selectByAcInvoiceCOBill", acInvoiceCoBill.AcInvoiceCOBillId));
 }
Ejemplo n.º 25
0
 protected override void MoveFirst()
 {
     this._acInvoiceCoBill = this._acInvoiceCoBillManager.Get(this._acInvoiceCoBillManager.GetFirst() == null ? "" : this._acInvoiceCoBillManager.GetFirst().AcInvoiceCOBillId);
 }
Ejemplo n.º 26
0
 public Model.AcInvoiceCOBill GetNext(Model.AcInvoiceCOBill e)
 {
     return(accessor.GetNext(e));
 }
Ejemplo n.º 27
0
 public void Delete(Model.AcInvoiceCOBill acInvoiceCoBill)
 {
     sqlmapper.Delete("AcInvoiceCOBillDetail.delete_detail_AcinvoiceCoBilID", acInvoiceCoBill.AcInvoiceCOBillId);
 }
Ejemplo n.º 28
0
 public void Update(Model.AcInvoiceCOBill e)
 {
     this.Update <Model.AcInvoiceCOBill>(e);
 }
Ejemplo n.º 29
0
 public IList <Model.AcInvoiceCOBillDetail> SelectByAcInvoiceCOBill(Model.AcInvoiceCOBill acInvoiceCoBill)
 {
     return(accessor.SelectByAcInvoiceCOBill(acInvoiceCoBill));
 }
Ejemplo n.º 30
0
 public Model.AcInvoiceCOBill GetPrev(Model.AcInvoiceCOBill e)
 {
     return(accessor.GetPrev(e));
 }