Esempio n. 1
0
        private void AddDataRows()
        {
            Model.AcOtherShouldPaymentDetail detail = new Book.Model.AcOtherShouldPaymentDetail();
            detail.AcOtherShouldPaymentDetailId = Guid.NewGuid().ToString();
            detail.AcOtherShouldPaymentId       = this.AcOtherShouldPayment.AcOtherShouldPaymentId;
            detail.AcOtherShouldPayment         = this.AcOtherShouldPayment;
            detail.AcItemPrice = 0;
            detail.AcMoney     = 0;
            detail.AcQuantity  = 0;
            this.AcOtherShouldPayment.Details.Add(detail);

            this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
            this.gridControl1.RefreshDataSource();
        }
Esempio n. 2
0
 private void simpleButtonA_Click(object sender, EventArgs e)
 {
     APParameterSet.ChooseAcItem f = new Book.UI.AccountPayable.APParameterSet.ChooseAcItem();
     if (f.ShowDialog(this) == DialogResult.OK)
     {
         Model.AcOtherShouldPaymentDetail detail = new Book.Model.AcOtherShouldPaymentDetail();
         Model.AcItem acitem = f.SelectedItem as Model.AcItem;
         detail.AcOtherShouldPaymentDetailId = Guid.NewGuid().ToString();
         detail.AcOtherShouldPaymentId       = this.AcOtherShouldPayment.AcOtherShouldPaymentId;
         detail.LoanName    = acitem.ItemName;
         detail.AcQuantity  = 0;
         detail.AcMoney     = 0;
         detail.AcItemPrice = acitem.ItemPrice;
         detail.AcItemId    = acitem.AcItemId;
         this.AcOtherShouldPayment.Details.Add(detail);
         this.gridControl1.RefreshDataSource();
         this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
     }
     //Model.AcOtherShouldPaymentDetail detail = new Model.AcOtherShouldPaymentDetail();
     //detail.AcOtherShouldPaymentId = this.AcOtherShouldPayment.AcOtherShouldPaymentId;
     //this.AcOtherShouldPayment.Details.Add(detail);
     //this.gridControl1.RefreshDataSource();
     //this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
 }
Esempio n. 3
0
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column == this.colAcItemPrice || e.Column == this.colAcQuantity)
            {
                Model.AcOtherShouldPaymentDetail CurrentDetail = this.AcOtherShouldPayment.Details[e.RowHandle];
                double?mInvoiceTaxrate   = (calcTaxRate.EditValue == null || string.IsNullOrEmpty(this.calcTaxRate.EditValue.ToString())) ? 0 : double.Parse(this.calcTaxRate.EditValue.ToString());
                global::Helper.TaxType t = (Helper.TaxType) this.TaxType.SelectedIndex;

                CurrentDetail.AcItemPrice = this.GetDecimal((CurrentDetail.AcItemPrice.HasValue ? CurrentDetail.AcItemPrice.Value : 0), BL.V.SetDataFormat.CGDJXiao.Value);
                //CurrentDetail.AcQuantity = this.GetDecimal(CurrentDetail.AcQuantity.HasValue ? CurrentDetail.AcQuantity.Value : 0, BL.V.SetDataFormat.CGSLXiao.Value);
                CurrentDetail.AcMoney = this.GetDecimal(CurrentDetail.AcItemPrice.Value * CurrentDetail.AcQuantity.Value, BL.V.SetDataFormat.CGJEXiao.Value);

                if (CurrentDetail.AcQuantity.HasValue && CurrentDetail.AcQuantity.Value > 0)
                {
                    CurrentDetail.TaxCalualateDictionary = new global::Helper.TaxCalculateHelper(t, mInvoiceTaxrate.Value, mInvoiceTaxrate.Value, CurrentDetail.AcMoney.Value, CurrentDetail.AcQuantity.Value).TaxCalculateDictionary;
                    this.CalculateMoney();
                }

                this.gridControl1.RefreshDataSource();
                //this.CalcHeJI();
            }

            if (e.Column == this.colLoanName)
            {
                Model.AcOtherShouldPaymentDetail CurrentDetail = this.AcOtherShouldPayment.Details[e.RowHandle];
                IList <Model.AcItem>             acilist       = (from Model.AcItem ac in acitemlist
                                                                  where ac.ItemName == CurrentDetail.LoanName
                                                                  select ac).ToList <Model.AcItem>();

                if (acilist != null && acilist.Count != 0)
                {
                    Model.AcItem aci = acilist.First <Model.AcItem>();

                    CurrentDetail.AcItemId = aci.AcItemId;
                    CurrentDetail.AcItem   = aci;
                    CurrentDetail.LoanName = aci.ItemName;

                    double?mInvoiceTaxrate   = (calcTaxRate.EditValue == null || string.IsNullOrEmpty(this.calcTaxRate.EditValue.ToString())) ? 0 : double.Parse(this.calcTaxRate.EditValue.ToString());
                    global::Helper.TaxType t = (Helper.TaxType) this.TaxType.SelectedIndex;

                    CurrentDetail.AcItemPrice = this.GetDecimal(aci.ItemPrice.HasValue ? aci.ItemPrice.Value : 0, BL.V.SetDataFormat.CGDJXiao.Value);
                    //CurrentDetail.AcQuantity = this.GetDecimal(CurrentDetail.AcQuantity.HasValue ? CurrentDetail.AcQuantity.Value : 0, BL.V.SetDataFormat.CGSLXiao.Value);
                    CurrentDetail.AcMoney = this.GetDecimal(CurrentDetail.AcItemPrice.Value * CurrentDetail.AcQuantity.Value, BL.V.SetDataFormat.CGJEXiao.Value);

                    if (CurrentDetail.AcQuantity.HasValue && CurrentDetail.AcQuantity.Value > 0)
                    {
                        CurrentDetail.TaxCalualateDictionary = new global::Helper.TaxCalculateHelper(t, mInvoiceTaxrate.Value, mInvoiceTaxrate.Value, CurrentDetail.AcMoney.Value, CurrentDetail.AcQuantity.Value).TaxCalculateDictionary;
                        this.CalculateMoney();
                    }

                    this.gridControl1.RefreshDataSource();
                }
                else
                {
                    CurrentDetail             = new Book.Model.AcOtherShouldPaymentDetail();
                    CurrentDetail.AcItemPrice = 0;
                    CurrentDetail.AcMoney     = 0;
                    CurrentDetail.AcQuantity  = 0;
                    this.gridControl1.RefreshDataSource();
                }
            }
        }