Exemplo n.º 1
0
 /// <summary>
 /// 尾笔
 /// </summary>
 protected override void MoveLast()
 {
     // if (_acbeginAccountPayble == null)
     {
         this._acInvoiceXoBill = this._acInvoiceXoBillManager.Get(this._acInvoiceXoBillManager.GetLast() == null ? "" : this._acInvoiceXoBillManager.GetLast().AcInvoiceXOBillId);
     }
 }
Exemplo n.º 2
0
        private void TiGuiExists(Model.AcInvoiceXOBill model)
        {
            if (this.ExistsPrimary(model.AcInvoiceXOBillId))
            {
                //设置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.AcInvoiceXOBillId = this.GetId(model.InsertTime.Value);
                TiGuiExists(model);
                //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
            }
            if (this.IsExistsId(model.Id))   //发票编号重复
            {
                model.Id = GetIdNumber();

                while (this.IsExistsId(model.Id))
                {
                    AddIdNumber();
                    model.Id = GetIdNumber();
                }
            }
        }
Exemplo n.º 3
0
        public void Delete(Model.AcInvoiceXOBill acInvoiceXOBill)
        {
            try
            {
                BL.V.BeginTransaction();

                calEffect(acInvoiceXOBill.Details);
                accessorDetails.Delete(acInvoiceXOBill);

                this.Delete(acInvoiceXOBill.AcInvoiceXOBillId);

                //发票编号回收
                //Model.BillIdDeleted billIdDeleted = new Book.Model.BillIdDeleted();
                //billIdDeleted.BillId = acInvoiceXOBill.Id;
                //billIdDeleted.DeleteTime = DateTime.Now;
                //billIdDeleted.BillIdSetId = billIdSet.BillIdSetId;
                //BillIdDeletedManager.Insert(billIdDeleted);


                Model.BillIdSet billIdSet = new BL.BillIdSetManager().SelectEnable();
                billIdSet.IdNumber = Convert.ToInt32(billIdSet.IdNumber) - 1;
                new BL.BillIdSetManager().UpdateIdnumber(billIdSet);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Insert a AcInvoiceXOBill.
        /// </summary>
        public void Insert(Model.AcInvoiceXOBill acInvoiceXOBill)
        {
            //
            // todo:add other logic here
            //
            Validate(acInvoiceXOBill);
            try
            {
                BL.V.BeginTransaction();
                acInvoiceXOBill.InsertTime = DateTime.Now;
                TiGuiExists(acInvoiceXOBill);
                acInvoiceXOBill.UpdateTime = DateTime.Now;

                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, acInvoiceXOBill.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, acInvoiceXOBill.InsertTime.Value.Year, acInvoiceXOBill.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, acInvoiceXOBill.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(acInvoiceXOBill);
                addDetail(acInvoiceXOBill);
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Exemplo n.º 5
0
 private void calEffect(IList <Model.AcCollectionDetail> detail)
 {
     foreach (Model.AcCollectionDetail item in detail)
     {
         if (string.IsNullOrEmpty(item.AcInvoiceId))
         {
             continue;
         }
         if (item.AcInvoiceType == "銷售發票單")
         {
             Model.AcInvoiceXOBill xobill = acInvoiceXOBillaccessor.Get(item.AcInvoiceId);
             if (xobill == null)
             {
                 continue;
             }
             xobill.mHeXiaoJingE  = xobill.mHeXiaoJingE == null ? 0 : xobill.mHeXiaoJingE - item.DomesticThisChargeMoney;
             xobill.NoHeXiaoTotal = xobill.ZongMoney - xobill.mHeXiaoJingE;
             acInvoiceXOBillaccessor.Update(xobill);
         }
         else if (item.AcInvoiceType == "其它應收款")
         {
             Model.AcOtherShouldCollection acoSc = acOtherShouldCollectionAccessor.Get(item.AcInvoiceId);
             if (acoSc == null)
             {
                 continue;
             }
             acoSc.mHeXiaoJingE  = acoSc.mHeXiaoJingE == null ? 0 : acoSc.mHeXiaoJingE - item.DomesticThisChargeMoney;
             acoSc.NoHeXiaoTotal = acoSc.HeJi - acoSc.mHeXiaoJingE;
             acOtherShouldCollectionAccessor.Update(acoSc);
         }
     }
 }
Exemplo n.º 6
0
        private void addDetail(Model.AcCollection acCollection)
        {
            foreach (Model.AcCollectionDetail item in acCollection.Detail)
            {
                if (string.IsNullOrEmpty(item.AcInvoiceId))
                {
                    continue;
                }
                item.AcCollectionId = acCollection.AcCollectionId;
                if (item.AcInvoiceType == "銷售發票單")
                {
                    Model.AcInvoiceXOBill xobill = acInvoiceXOBillaccessor.Get(item.AcInvoiceId);
                    if (xobill == null)
                    {
                        goto mustdo;
                    }
                    xobill.mHeXiaoJingE  = xobill.mHeXiaoJingE == null ? 0 : xobill.mHeXiaoJingE + item.DomesticThisChargeMoney;
                    xobill.NoHeXiaoTotal = xobill.ZongMoney - xobill.mHeXiaoJingE;
                    acInvoiceXOBillaccessor.Update(xobill);
                }
                else if (item.AcInvoiceType == "其它應收款")
                {
                    Model.AcOtherShouldCollection acoSc = acOtherShouldCollectionAccessor.Get(item.AcInvoiceId);
                    if (acoSc == null)
                    {
                        goto mustdo;
                    }
                    acoSc.mHeXiaoJingE  = acoSc.mHeXiaoJingE == null ? 0 : acoSc.mHeXiaoJingE + item.DomesticThisChargeMoney;
                    acoSc.NoHeXiaoTotal = acoSc.HeJi - acoSc.mHeXiaoJingE;
                    acOtherShouldCollectionAccessor.Update(acoSc);
                }
mustdo:
                acCollectionDetailaccessor.Insert(item);
            }
        }
Exemplo n.º 7
0
        public bool ExistsExcept(Model.AcInvoiceXOBill e)
        {
            Hashtable paras = new Hashtable();

            paras.Add("newId", e.Id);
            paras.Add("oldId", Get(e.AcInvoiceXOBillId) == null?null:Get(e.AcInvoiceXOBillId).Id);
            return(sqlmapper.QueryForObject <bool>("AcInvoiceXOBill.existsexcept", paras));
        }
Exemplo n.º 8
0
 public Model.AcInvoiceXOBill GetDetails(Model.AcInvoiceXOBill acinvoiceXoBill)
 {
     if (acinvoiceXoBill != null)
     {
         acinvoiceXoBill.Details = accessorDetails.SelectByAcInvoiceXOBill(acinvoiceXoBill);
     }
     return(acinvoiceXoBill);
 }
Exemplo n.º 9
0
 protected override void MoveNext()
 {
     Model.AcInvoiceXOBill temp = this._acInvoiceXoBillManager.GetNext(this._acInvoiceXoBill);
     if (temp == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._acInvoiceXoBill = this._acInvoiceXoBillManager.Get(temp.AcInvoiceXOBillId);
 }
Exemplo n.º 10
0
        public override void Refresh()
        {
            if (this._acInvoiceXoBill == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._acInvoiceXoBill = this._acInvoiceXoBillManager.GetDetails(this._acInvoiceXoBill);
                    if (this._acInvoiceXoBill == null)
                    {
                        this._acInvoiceXoBill = new Book.Model.AcInvoiceXOBill();
                    }
                }
            }
            this.newChooseCustomer2.EditValue = this._acInvoiceXoBill.CustomerShouPiao;
            this.AcInvoiceXOBillId.Text       = this._acInvoiceXoBill.AcInvoiceXOBillId;
            this.XoId.Text = this._acInvoiceXoBill.Id;
            this.memoAcInvoiceXOBillDesc.Text     = this._acInvoiceXoBill.AcInvoiceXOBillDesc;
            this.dateAcInvoiceXOBillDate.DateTime = this._acInvoiceXoBill.AcInvoiceXOBillDate.Value;
            this.calcHeJiMoney.Value     = this._acInvoiceXoBill.HeJiMoney == null ? 0 : this._acInvoiceXoBill.HeJiMoney.Value;
            this.TaxType.SelectedIndex   = Convert.ToInt32(this._acInvoiceXoBill.TaxRateType);
            this.calcTaxRate.Value       = Convert.ToDecimal(this._acInvoiceXoBill.TaxRate == null ? 0 : this._acInvoiceXoBill.TaxRate.Value);
            this.calcTaxRateMoney.Value  = this._acInvoiceXoBill.TaxRateMoney == null ? 0 : this._acInvoiceXoBill.TaxRateMoney.Value;
            this.calcZongMoney.Value     = this._acInvoiceXoBill.ZongMoney == null ? 0 : this._acInvoiceXoBill.ZongMoney.Value;
            this.calcmHeXiaoJingE.Value  = this._acInvoiceXoBill.mHeXiaoJingE == null ? 0 : this._acInvoiceXoBill.mHeXiaoJingE.Value;
            this.calcNoHeXiaoTotal.Value = this._acInvoiceXoBill.NoHeXiaoTotal == null ? 0 : this._acInvoiceXoBill.NoHeXiaoTotal.Value;
            //  this.dateForYSDate.DateTime = this._acInvoiceXoBill.YSDate == null ? DateTime.Now : this._acInvoiceXoBill.YSDate.Value;
            this.newChooseEmployee0Id.EditValue = this._acInvoiceXoBill.AuditEmp;
            //  this.newChooseEmployee1Id.EditValue = this._acInvoiceXoBill.Employee1;
            this.newChooseEmployeeId.EditValue = this._acInvoiceXoBill.Employee;
            this.newChooseCustomerId.EditValue = this._acInvoiceXoBill.Customer;

            this.txt_AuditState.EditValue        = this.GetAuditName(this._acInvoiceXoBill.AuditState);
            this.bindingSourceDetails.DataSource = this._acInvoiceXoBill.Details;

            base.Refresh();
            //if (this.action == "view")
            //{
            //    this.barBtnChuHuoDan.Enabled = false;
            //}
            //else
            //{
            //    this.barBtnChuHuoDan.Enabled = true;
            //}

            this.newChooseEmployeeId.Enabled = false;
            // this.calcHeJiMoney.Enabled = false;
            this.calcZongMoney.Enabled     = false;
            this.calcTaxRateMoney.Enabled  = false;
            this.calcmHeXiaoJingE.Enabled  = false;
            this.calcNoHeXiaoTotal.Enabled = false;
        }
Exemplo n.º 11
0
 protected override void AddNew()
 {
     this._acInvoiceXoBill = new Model.AcInvoiceXOBill();
     this._acInvoiceXoBill.AcInvoiceXOBillId   = this._acInvoiceXoBillManager.GetId(DateTime.Now);
     this._acInvoiceXoBill.AcInvoiceXOBillDate = DateTime.Now;
     this._acInvoiceXoBill.Employee            = BL.V.ActiveOperator.Employee;
     this._acInvoiceXoBill.TaxRateType         = 1;
     this._acInvoiceXoBill.TaxRate             = 5;
     this._acInvoiceXoBill.Details             = new List <Model.AcInvoiceXOBillDetail>();
 }
Exemplo n.º 12
0
        /// <summary>
        /// Update a AcInvoiceXOBill.
        /// </summary>
        public void Update(Model.AcInvoiceXOBill acInvoiceXOBill)
        {
            Validate(acInvoiceXOBill);

            acInvoiceXOBill.UpdateTime = DateTime.Now;
            accessor.Update(acInvoiceXOBill);
            IList <Model.AcInvoiceXOBillDetail> olddetail = accessorDetails.SelectByAcInvoiceXOBill(acInvoiceXOBill);

            calEffect(olddetail);
            accessorDetails.Delete(acInvoiceXOBill);
            addDetail(acInvoiceXOBill);
        }
Exemplo n.º 13
0
        private void barButtonSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ListForm lf = new ListForm();

            if (lf.ShowDialog(this) == DialogResult.OK)
            {
                this._acInvoiceXoBill = (Model.AcInvoiceXOBill)lf.SelectItem;
                this.action           = "view";
                this.Refresh();
            }
            lf.Dispose();
            GC.Collect();
        }
Exemplo n.º 14
0
 private void addDetail(Model.AcInvoiceXOBill acInvoiceXOBill)
 {
     foreach (Model.AcInvoiceXOBillDetail Detail in acInvoiceXOBill.Details)
     {
         //if (string.IsNullOrEmpty(Detail.InvoiceId)) continue;
         Detail.AcInvoiceXOBillId = acInvoiceXOBill.AcInvoiceXOBillId;
         accessorDetails.Insert(Detail);
         Model.InvoiceXSDetail ixsd = mInvoiceXSDetailAccessor.Get(Detail.InvoiceXODetailId);
         if (ixsd != null)
         {
             ixsd.InvoiceXSDetailFPQuantity = Convert.ToDouble(ixsd.InvoiceXSDetailFPQuantity) + Convert.ToDouble(Detail.InvoiceXODetaiInQuantity);
         }
         mInvoiceXSDetailAccessor.Update(ixsd);
     }
 }
Exemplo n.º 15
0
 private void Validate(Model.AcInvoiceXOBill AcInvoiceXOBill)
 {
     if (string.IsNullOrEmpty(AcInvoiceXOBill.Id))
     {
         throw new Helper.RequireValueException(Model.AcInvoiceXOBill.PRO_Id);
     }
     if (string.IsNullOrEmpty(AcInvoiceXOBill.CustomerId))
     {
         throw new Helper.RequireValueException(Model.AcInvoiceXOBill.PRO_CustomerId);
     }
     if (AcInvoiceXOBill.Details == null || AcInvoiceXOBill.Details.Count == 0)
     {
         throw new Helper.RequireValueException("AcInvoiceXOBill.Details");
     }
 }
Exemplo n.º 16
0
        protected override void AddNew()
        {
            this._acInvoiceXoBill = new Model.AcInvoiceXOBill();
            this._acInvoiceXoBill.AcInvoiceXOBillId   = this._acInvoiceXoBillManager.GetId(DateTime.Now);
            this._acInvoiceXoBill.AcInvoiceXOBillDate = DateTime.Now;
            this._acInvoiceXoBill.Employee            = BL.V.ActiveOperator.Employee;
            this._acInvoiceXoBill.TaxRateType         = 1;
            this._acInvoiceXoBill.TaxRate             = 5;
            this._acInvoiceXoBill.IsCancel            = 0;
            this._acInvoiceXoBill.ClearanceType       = "1";
            this._acInvoiceXoBill.SalesType           = "0";
            this._acInvoiceXoBill.Details             = new List <Model.AcInvoiceXOBillDetail>();


            //生成發票編號
            GenerateBillId();
        }
Exemplo n.º 17
0
        public void Delete(Model.AcInvoiceXOBill acInvoiceXOBill)
        {
            try
            {
                BL.V.BeginTransaction();

                calEffect(acInvoiceXOBill.Details);
                accessorDetails.Delete(acInvoiceXOBill);

                this.Delete(acInvoiceXOBill.AcInvoiceXOBillId);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Exemplo n.º 18
0
        public Ro(Model.AcInvoiceXOBill acInvoiceXOBill)
        {
            InitializeComponent();

            //报表标题
            this.ReportName.Text  = BL.Settings.CompanyChineseName;
            this.ReportTitle.Text = Properties.Resources.AcInvoiceXOBill;
            //列印日期
            this.ReportDate.Text += System.DateTime.Now.ToShortDateString();
            //头资料
            this.AcInvoiceXOBillId.Text = acInvoiceXOBill.AcInvoiceXOBillId;
            this.lblfpbh.Text           = acInvoiceXOBill.Id;
            this.RepDate.Text           = acInvoiceXOBill.AcInvoiceXOBillDate.Value.ToString("yyyy-MM-dd");
            this.lblBeiZhu.Text         = acInvoiceXOBill.AcInvoiceXOBillDesc;
            //this.newChooseCustomerId.Text = acInvoiceXOBill.Employee.ToString();
            this.newChooseCustomerId.Text = acInvoiceXOBill.Customer.CustomerShortName;
            //this.newChooseEmployee0Id.Text = acInvoiceXOBill.Employee0.ToString();
            this.newChooseEmployeeId.Text  = string.IsNullOrEmpty(acInvoiceXOBill.EmployeeId) ? "" : acInvoiceXOBill.Employee.ToString();
            this.newChooseEmployee1Id.Text = string.IsNullOrEmpty(acInvoiceXOBill.Employee1Id) ? "" : acInvoiceXOBill.Employee1.ToString();
            this.newChooseEmployee0Id.Text = string.IsNullOrEmpty(acInvoiceXOBill.Employee0Id) ? "" : acInvoiceXOBill.Employee0.ToString();

            this.calcTaxRate.Text      = acInvoiceXOBill.TaxRate.ToString();
            this.calcTaxRateMoney.Text = acInvoiceXOBill.TaxRateMoney.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
            this.calcShuiBie.Text      = acInvoiceXOBill.TaxRateType.ToString();
            this.calcHeJi.Text         = acInvoiceXOBill.HeJiMoney.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));;
            this.calcZongE.Text        = acInvoiceXOBill.ZongMoney.Value.ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
            this.lblYSDate.Text        = acInvoiceXOBill.YSDate == null ? "" : acInvoiceXOBill.YSDate.Value.ToString();
            this.lblmHeXiaoJingE.Text  = (acInvoiceXOBill.mHeXiaoJingE == null ? 0 : acInvoiceXOBill.mHeXiaoJingE.Value).ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
            this.lblNoHeXiaoTotal.Text = (acInvoiceXOBill.NoHeXiaoTotal == null ? 0 : acInvoiceXOBill.NoHeXiaoTotal.Value).ToString(global::Helper.DateTimeParse.GetFormat(BL.V.SetDataFormat.XSZJXiao.Value));
            //绑定详细数据源
            this.DataSource = acInvoiceXOBill.Details;
            //详细资料
            this.CellInvoiceId.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceId);
            this.CellProduct.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.CellInvoiceAllowance.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceAllowance);
            this.CellInvoiceXODetailPrice.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailPrice, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSDJXiao.Value));
            this.CellInvoiceXODetaiInQuantity.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetaiInQuantity);
            this.CellInvoiceXODetailMoney.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.CellInvoiceXODetailTax.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailTax, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.CellInvoiceXODetailTaxMoney.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailTaxMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.CellInvoiceXODetailTaxPrice.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailTaxPrice, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSDJXiao.Value));
        }
Exemplo n.º 19
0
 protected override void Delete()
 {
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
     {
         return;
     }
     try
     {
         this._acInvoiceXoBillManager.Delete(this._acInvoiceXoBill);
         this._acInvoiceXoBill = this._acInvoiceXoBillManager.GetNext(this._acInvoiceXoBill);
         if (this._acInvoiceXoBill == null)
         {
             this._acInvoiceXoBill = this._acInvoiceXoBillManager.GetLast();
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 20
0
 public Model.AcInvoiceXOBill GetNext(Model.AcInvoiceXOBill e)
 {
     return(sqlmapper.QueryForObject <Model.AcInvoiceXOBill>("AcInvoiceXOBill.get_next", e));
 }
Exemplo n.º 21
0
 protected override void MoveFirst()
 {
     this._acInvoiceXoBill = this._acInvoiceXoBillManager.Get(this._acInvoiceXoBillManager.GetFirst() == null ? "" : this._acInvoiceXoBillManager.GetFirst().AcInvoiceXOBillId);
 }
Exemplo n.º 22
0
        public FPRO(Model.AcInvoiceXOBill model)
            : this()
        {
            this.DataSource = list = model.Details;
            if (model.AcInvoiceXOBillDate.HasValue)
            {
                this.lblYear.Text  = (model.AcInvoiceXOBillDate.Value.Year - 1911).ToString();
                this.lblMonth.Text = model.AcInvoiceXOBillDate.Value.Month.ToString();
                this.lblDay.Text   = model.AcInvoiceXOBillDate.Value.Day.ToString();
            }

            this.lblFPNo.Text = model.Id;
            //¼ì²éÂë
            if (!string.IsNullOrEmpty(model.Id))
            {
                string englishid1 = model.Id.Substring(0, 1);
                string englishid2 = model.Id.Substring(1, 1);

                decimal x = Math.Truncate((decimal)(((int)System.Text.Encoding.ASCII.GetBytes(englishid1)[0] * (int)System.Text.Encoding.ASCII.GetBytes(englishid2)[0]) / 2)) % 10;

                string  str = model.Id.Substring(2);
                decimal y   = 0;
                for (int i = 0; i < str.Length; i++)
                {
                    y += Convert.ToInt32(str.Substring(i, 1)) * (i + 1);
                }
                y = y % 10;

                this.lblCheckNo.Text = x.ToString() + y.ToString();
            }
            //if (!string.IsNullOrEmpty(model.Id))
            //{
            //    int x = Convert.ToInt32((Convert.ToInt32(model.Id.Substring(2)) + 84562911).ToString().Substring((Convert.ToInt32(model.Id.Substring(2)) + 84562911).ToString().Length - 8));
            //    string str = x.ToString();
            //    int y = Convert.ToInt32(str.Substring(0, 2)) + Convert.ToInt32(str.Substring(2, 2)) + Convert.ToInt32(str.Substring(4, 2)) + Convert.ToInt32(str.Substring(6, 2));
            //    this.lblCheckNo.Text = (100 - y % 100).ToString();
            //}
            if (model.CustomerShouPiao != null)
            {
                this.lblBuyer.Text   = model.CustomerShouPiao.CustomerFullName;
                this.lblUniteNo.Text = model.CustomerShouPiao.CustomerNumber;
                this.lblAddress.Text = model.CustomerShouPiao.CustomerAddress;
            }

            string s = "";

            foreach (var item in model.Details)
            {
                if (!string.IsNullOrEmpty(item.InvoiceCOIdNote))
                {
                    //string[] str = item.InvoiceCOIdNote.Split(',');
                    //foreach (var id in str)
                    //{
                    if (!s.Contains(item.InvoiceCOIdNote))
                    {
                        s += item.InvoiceCOIdNote + ",";
                    }
                    //}
                }
            }
            if (s.Length >= 1)
            {
                this.lblNote.Text = s.Substring(0, s.Length - 1);
            }

            lblHeji.Text  = model.HeJiMoney.HasValue ? model.HeJiMoney.Value.ToString("0.##") : "";
            lblTax.Text   = model.TaxRateMoney.HasValue ? model.TaxRateMoney.Value.ToString("0.##") : "";
            lblTotal.Text = model.ZongMoney.HasValue ? model.ZongMoney.Value.ToString("0.##") : "";
            switch (model.TaxRateType)
            {
            case 0:
                this.lblNoTax.Text = "¡Ì";
                break;

            case 1:
                this.lblShouldTax.Text = "¡Ì";
                break;

            case 2:
                this.lblZeroTax.Text = "¡Ì";
                break;
            }
            string totalmoney = (model.ZongMoney.HasValue ? model.ZongMoney.Value : 0).ToString("##########");
            string ge = "", shi = "", bai = "", qian = "", wan = "", shiwan = "", baiwan = "", qianwan = "";

            //if (totalmoney.Length > 8)
            //{
            //    ge = totalmoney.Substring(totalmoney.Length - 1);
            //    shi = totalmoney.Substring(totalmoney.Length - 2, 1);
            //    bai = totalmoney.Substring(totalmoney.Length - 3, 1);
            //    qian = totalmoney.Substring(totalmoney.Length - 4, 1);
            //    wan = totalmoney.Substring(totalmoney.Length - 5, 1);
            //    shiwan = totalmoney.Substring(totalmoney.Length - 6, 1);
            //    baiwan = totalmoney.Substring(totalmoney.Length - 7, 1);
            //    qianwan = totalmoney.Substring(0, totalmoney.Length - 8 + 1);
            //}
            if (totalmoney.Length == 8)
            {
                ge      = totalmoney.Substring(totalmoney.Length - 1);
                shi     = totalmoney.Substring(totalmoney.Length - 2, 1);
                bai     = totalmoney.Substring(totalmoney.Length - 3, 1);
                qian    = totalmoney.Substring(totalmoney.Length - 4, 1);
                wan     = totalmoney.Substring(totalmoney.Length - 5, 1);
                shiwan  = totalmoney.Substring(totalmoney.Length - 6, 1);
                baiwan  = totalmoney.Substring(totalmoney.Length - 7, 1);
                qianwan = totalmoney.Substring(totalmoney.Length - 8, 1);
            }
            else if (totalmoney.Length == 7)
            {
                ge     = totalmoney.Substring(totalmoney.Length - 1);
                shi    = totalmoney.Substring(totalmoney.Length - 2, 1);
                bai    = totalmoney.Substring(totalmoney.Length - 3, 1);
                qian   = totalmoney.Substring(totalmoney.Length - 4, 1);
                wan    = totalmoney.Substring(totalmoney.Length - 5, 1);
                shiwan = totalmoney.Substring(totalmoney.Length - 6, 1);
                baiwan = totalmoney.Substring(totalmoney.Length - 7, 1);
            }
            else if (totalmoney.Length == 6)
            {
                ge     = totalmoney.Substring(totalmoney.Length - 1);
                shi    = totalmoney.Substring(totalmoney.Length - 2, 1);
                bai    = totalmoney.Substring(totalmoney.Length - 3, 1);
                qian   = totalmoney.Substring(totalmoney.Length - 4, 1);
                wan    = totalmoney.Substring(totalmoney.Length - 5, 1);
                shiwan = totalmoney.Substring(totalmoney.Length - 6, 1);
            }
            else if (totalmoney.Length == 5)
            {
                ge   = totalmoney.Substring(totalmoney.Length - 1);
                shi  = totalmoney.Substring(totalmoney.Length - 2, 1);
                bai  = totalmoney.Substring(totalmoney.Length - 3, 1);
                qian = totalmoney.Substring(totalmoney.Length - 4, 1);
                wan  = totalmoney.Substring(totalmoney.Length - 5, 1);
            }
            else if (totalmoney.Length == 4)
            {
                ge   = totalmoney.Substring(totalmoney.Length - 1);
                shi  = totalmoney.Substring(totalmoney.Length - 2, 1);
                bai  = totalmoney.Substring(totalmoney.Length - 3, 1);
                qian = totalmoney.Substring(totalmoney.Length - 4, 1);
            }
            else if (totalmoney.Length == 3)
            {
                ge  = totalmoney.Substring(totalmoney.Length - 1);
                shi = totalmoney.Substring(totalmoney.Length - 2, 1);
                bai = totalmoney.Substring(totalmoney.Length - 3, 1);
            }
            else if (totalmoney.Length == 2)
            {
                ge  = totalmoney.Substring(totalmoney.Length - 1);
                shi = totalmoney.Substring(totalmoney.Length - 2, 1);
            }
            else if (totalmoney.Length == 1)
            {
                ge = totalmoney.Substring(totalmoney.Length - 1);
            }

            this.lblGe.Text      = this.ConvertData(ge);
            this.lblShi.Text     = this.ConvertData(shi);
            this.lblBai.Text     = this.ConvertData(bai);
            this.lblQian.Text    = this.ConvertData(qian);
            this.lblWan.Text     = this.ConvertData(wan);
            this.lblShiwan.Text  = this.ConvertData(shiwan);
            this.lblBaiwan.Text  = this.ConvertData(baiwan);
            this.lblQianwan.Text = this.ConvertData(qianwan);

            //TCProduct.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            //TCQuantity.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetaiInQuantity, "{0:0.##}");
            //TCPrice.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailPrice, "{0:0.##}");
            //TCMoney.DataBindings.Add("Text", this.DataSource, Model.AcInvoiceXOBillDetail.PRO_InvoiceXODetailMoney, "{0:0.##}");
        }
Exemplo n.º 23
0
 public void Insert(Model.AcInvoiceXOBill e)
 {
     this.Insert <Model.AcInvoiceXOBill>(e);
 }
Exemplo n.º 24
0
 public bool HasRowsBefore(Model.AcInvoiceXOBill e)
 {
     return(sqlmapper.QueryForObject <bool>("AcInvoiceXOBill.has_rows_before", e));
 }
Exemplo n.º 25
0
 public void Update(Model.AcInvoiceXOBill e)
 {
     this.Update <Model.AcInvoiceXOBill>(e);
 }
Exemplo n.º 26
0
 public bool HasRowsAfter(Model.AcInvoiceXOBill e)
 {
     return(sqlmapper.QueryForObject <bool>("AcInvoiceXOBill.has_rows_after", e));
 }
Exemplo n.º 27
0
        protected override void Save()
        {
            this._acInvoiceXoBill.AcInvoiceXOBillId = this.AcInvoiceXOBillId.Text;
            this._acInvoiceXoBill.Id       = this.XoId.Text;
            this._acInvoiceXoBill.Customer = this.newChooseCustomerId.EditValue as Model.Customer;
            if (this._acInvoiceXoBill.Customer != null)
            {
                this._acInvoiceXoBill.CustomerId = this._acInvoiceXoBill.Customer.CustomerId;
            }
            this._acInvoiceXoBill.TaxRate          = Convert.ToDouble(this.calcTaxRate.Value);
            this._acInvoiceXoBill.TaxRateMoney     = this.calcTaxRateMoney.Value;
            this._acInvoiceXoBill.TaxRateType      = this.TaxType.SelectedIndex;
            this._acInvoiceXoBill.HeJiMoney        = this.calcHeJiMoney.Value;
            this._acInvoiceXoBill.ZongMoney        = this.calcZongMoney.Value;
            this._acInvoiceXoBill.mHeXiaoJingE     = this.calcmHeXiaoJingE.Value;
            this._acInvoiceXoBill.CustomerShouPiao = this.newChooseCustomer2.EditValue as Model.Customer;
            if (this.newChooseCustomer2.EditValue != null)
            {
                this._acInvoiceXoBill.CustomerShouPiaoId = this._acInvoiceXoBill.CustomerShouPiao.CustomerId;
            }
            this._acInvoiceXoBill.NoHeXiaoTotal = this.calcNoHeXiaoTotal.Value;
            if (global::Helper.DateTimeParse.DateTimeEquls(this.dateAcInvoiceXOBillDate.DateTime, new DateTime()))
            {
                this._acInvoiceXoBill.AcInvoiceXOBillDate = global::Helper.DateTimeParse.NullDate;
            }
            else
            {
                this._acInvoiceXoBill.AcInvoiceXOBillDate = this.dateAcInvoiceXOBillDate.DateTime;
            }

            if (this.action == "insert")
            {
                Model.AcInvoiceXOBill last = this._acInvoiceXoBillManager.GetLast();
                if (this._acInvoiceXoBill.AcInvoiceXOBillDate < last.AcInvoiceXOBillDate.Value.Date)
                {
                    throw new Helper.MessageValueException("發票日期不能小於上笔日期");
                }
            }
            else if (this.action == "update")
            {
                if (this._acInvoiceXoBill.AcInvoiceXOBillDate < this._acInvoiceXoBillManager.SelectLastDate(this._acInvoiceXoBill.InsertTime.Value).Date)
                {
                    throw new Helper.MessageValueException("發票日期不能小於上笔日期");
                }
            }
            //if (global::Helper.DateTimeParse.DateTimeEquls(this.dateForYSDate.DateTime, new DateTime()))
            //    this._acInvoiceXoBill.YSDate = global::Helper.DateTimeParse.NullDate;
            //else
            //    this._acInvoiceXoBill.YSDate = this.dateForYSDate.DateTime;
            this._acInvoiceXoBill.AcInvoiceXOBillDesc = this.memoAcInvoiceXOBillDesc.Text;
            this._acInvoiceXoBill.Employee            = this.newChooseEmployeeId.EditValue as Model.Employee;
            if (this._acInvoiceXoBill.Employee != null)
            {
                this._acInvoiceXoBill.EmployeeId = this._acInvoiceXoBill.Employee.EmployeeId;
            }
            this._acInvoiceXoBill.Employee0 = this.newChooseEmployee0Id.EditValue as Model.Employee;
            if (this._acInvoiceXoBill.Employee0 != null)
            {
                this._acInvoiceXoBill.Employee0Id = this._acInvoiceXoBill.Employee0.EmployeeId;
            }
            //    this._acInvoiceXoBill.Employee1 = this.newChooseEmployee1Id.EditValue as Model.Employee;
            //  if (this._acInvoiceXoBill.Employee1 != null)
            //    this._acInvoiceXoBill.Employee1Id = this._acInvoiceXoBill.Employee1.EmployeeId;

            this._acInvoiceXoBill.InvoiceStatus = 1;
            if (!this.gridView1.PostEditor() || !this.gridView1.UpdateCurrentRow())
            {
                return;
            }

            switch (this.action)
            {
            case "insert":
                this._acInvoiceXoBillManager.Insert(this._acInvoiceXoBill);
                break;

            case "update":
                this._acInvoiceXoBillManager.Update(this._acInvoiceXoBill);
                break;
            }
        }
Exemplo n.º 28
0
 public void Delete(Model.AcInvoiceXOBill acInvoiceXoBill)
 {
     sqlmapper.Delete("AcInvoiceXOBillDetail.delete_detail_AcinvoiceXoBilID", acInvoiceXoBill.AcInvoiceXOBillId);
 }
Exemplo n.º 29
0
 public IList <Model.AcInvoiceXOBillDetail> SelectByAcInvoiceXOBill(Model.AcInvoiceXOBill acInvoiceXoBill)
 {
     return(sqlmapper.QueryForList <Model.AcInvoiceXOBillDetail>("AcInvoiceXOBillDetail.selectByAcInvoiceXOBill", acInvoiceXoBill.AcInvoiceXOBillId));
 }
Exemplo n.º 30
0
 public Model.AcInvoiceXOBill GetPrev(Model.AcInvoiceXOBill e)
 {
     return(sqlmapper.QueryForObject <Model.AcInvoiceXOBill>("AcInvoiceXOBill.get_prev", e));
 }