示例#1
0
 public EditForm(Model.AcPayment acp, string action)
     : this()
 {
     this._acPayment = acp;
     this.action     = "view";
     LastFlag        = 1;
 }
示例#2
0
 /// <summary>
 /// Insert a AcPayment.
 /// </summary>
 public void Insert(Model.AcPayment acPayment)
 {
     Validate(acPayment);
     try
     {
         BL.V.BeginTransaction();
         acPayment.InsertTime = DateTime.Now;
         TiGuiExists(acPayment);
         acPayment.UpdateTime = DateTime.Now;
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, acPayment.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, acPayment.InsertTime.Value.Year, acPayment.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, acPayment.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(acPayment);
         addDetail(acPayment);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
示例#3
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);
            }
        }
示例#4
0
        public override void Refresh()
        {
            if (this._acPayment == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._acPayment = this._acPayManager.GetDetails(this._acPayment);
                    if (this._acPayment == null)
                    {
                        this._acPayment = new Book.Model.AcPayment();
                    }
                }
            }

            this.textEditAcPaymentId.Text       = this._acPayment.AcPaymentId;
            this.calcAdvancePaymentBalance.Text = this._acPayment.AdvancePaymentBalance == null ? "" : this._acPayment.AdvancePaymentBalance.Value.ToString();
            // this.calcAlreadyChargeMoney.Text = this._acPayment.AlreadyChargeMoney == null ? "" : this._acPayment.AlreadyChargeMoney.Value.ToString();
            // this.newChooseContorlAtCurrencyCategoryId.EditValue = this._acPayment.AtCurrencyCategory;
            this.textEditBankAccount.Text       = this._acPayment.BankAccount;
            this.memoAcDesc.Text                = this._acPayment.AcDesc;
            this.dateEditAcPaymentDate.DateTime = this._acPayment.AcPaymentDate == null ? global::Helper.DateTimeParse.NullDate : this._acPayment.AcPaymentDate.Value;
            this.textEditBillNo.Text            = this._acPayment.BillNo;
            // this.calcCashAgio.Text = this._acPayment.CashAgio == null ? "" : this._acPayment.CashAgio.Value.ToString();
            // this.calcEditDomesticCashAgio.Text = this._acPayment.DomesticCashAgio == null ? "" : this._acPayment.DomesticCashAgio.Value.ToString();
            this.calcDomesticEealityPayment.Text = this._acPayment.DomesticEealityPayment == null ? "" : this._acPayment.DomesticEealityPayment.Value.ToString();
            this.calcDomesticMayChargeMoney.Text = this._acPayment.DomesticMayChargeMoney == null ? "" : this._acPayment.DomesticMayChargeMoney.Value.ToString();
            // this.calcEealityPayment.Text = this._acPayment.EealityPayment == null ? "" : this._acPayment.EealityPayment.Value.ToString();
            this.newChooseContorlEmployeeId.EditValue  = this._acPayment.Employee;
            this.newChooseContorlEmployee0Id.EditValue = this._acPayment.AuditEmp;
            this.newChooseContorlEmployee1Id.EditValue = this._acPayment.Employee1;
            // this.calcJoinAdvancePayment.Text = this._acPayment.JoinAdvancePayment == null ? "" : this._acPayment.JoinAdvancePayment.Value.ToString();
            this.newChoosePayMethodId.EditValue       = this._acPayment.PayMethod;
            this.newChooseContorlSubjectId.EditValue  = this._acPayment.Subject;
            this.calcSubscriptionAdvancePayment.Text  = this._acPayment.SubscriptionAdvancePayment == null ? "" : this._acPayment.SubscriptionAdvancePayment.Value.ToString();
            this.newChooseContorlSupplierId.EditValue = this._acPayment.Supplier;
            this.textAuditingState.EditValue          = this.GetAuditName(this._acPayment.AuditState);
            this.bindingSourceDetails.DataSource      = this._acPayment.Detail;
            this.gridView1.GroupPanelText             = "共: " + (this._acPayment.Detail == null ? "0" : this._acPayment.Detail.Count + " 項");

            base.Refresh();

            if (this.action == "view")
            {
                this.barBtnInvoiceCG.Enabled = false;
            }
            else
            {
                this.barBtnInvoiceCG.Enabled = true;
            }
            this.calcAdvancePaymentBalance.Enabled  = false;
            this.calcDomesticMayChargeMoney.Enabled = false;
            this.calcDomesticCashAgio.Enabled       = false;
            this.newChooseContorlEmployeeId.Enabled = false;
        }
示例#5
0
 protected override void MoveLast()
 {
     if (LastFlag == 1)
     {
         LastFlag = 0;
         return;
     }
     this._acPayment = this._acPayManager.Get(this._acPayManager.GetLast() == null ? "" : this._acPayManager.GetLast().AcPaymentId);
 }
示例#6
0
 protected override void MovePrev()
 {
     Model.AcPayment temp = this._acPayManager.GetPrev(this._acPayment);
     if (temp == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._acPayment = this._acPayManager.Get(temp.AcPaymentId);
 }
示例#7
0
 public Model.AcPayment GetDetails(Model.AcPayment acPayment)
 {
     Model.AcPayment temp = accessor.Get(acPayment.AcPaymentId);
     if (temp != null)
     {
         temp.Detail = acPaymentDetailaccessor.Select(temp);
     }
     return(temp);
 }
示例#8
0
 protected override void AddNew()
 {
     this._acPayment               = new Model.AcPayment();
     this._acPayment.AcPaymentId   = this._acPayManager.GetId();
     this._acPayment.Employee      = BL.V.ActiveOperator.Employee;
     this._acPayment.AcPaymentDate = DateTime.Now;
     this._acPayment.SubscriptionAdvancePayment = 0;
     this._acPayment.EealityPayment             = 0;
     this._acPayment.DomesticMayChargeMoney     = 0;
     this._acPayment.Detail = new List <Model.AcPaymentDetail>();
 }
示例#9
0
        private void IbtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ListForm lf = new ListForm();

            if (lf.ShowDialog(this) == DialogResult.OK)
            {
                this._acPayment = (Model.AcPayment)lf.SelectItem;
                this.action     = "view";
                this.Refresh();
            }
            lf.Dispose();
            GC.Collect();
        }
示例#10
0
 public void Delete(Model.AcPayment acp)
 {
     try
     {
         BL.V.BeginTransaction();
         calEffect(acp.Detail);
         acPaymentDetailaccessor.DeleteByAcPaymentId(acp.AcPaymentId);
         this.Delete(acp.AcPaymentId);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
示例#11
0
 private void Validate(Model.AcPayment acPayment)
 {
     if (string.IsNullOrEmpty(acPayment.SupplierId))
     {
         throw new global::Helper.RequireValueException(Model.AcPayment.PRO_SupplierId);
     }
     if (string.IsNullOrEmpty(acPayment.PayMethodId))
     {
         throw new global::Helper.RequireValueException(Model.AcPayment.PRO_PayMethodId);
     }
     foreach (Model.AcPaymentDetail item in acPayment.Detail)
     {
         if (item.DomesticNoPaymentMoney < item.DomesticThisChargeMoney)
         {
             throw new global::Helper.InvalidValueException(Model.AcPaymentDetail.PRO_DomesticThisChargeMoney);
         }
     }
 }
示例#12
0
 private void TiGuiExists(Model.AcPayment model)
 {
     if (this.ExistsPrimary(model.AcPaymentId))
     {
         //设置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.AcPaymentId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
         //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
     }
 }
示例#13
0
 protected override void Delete()
 {
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
     {
         return;
     }
     try
     {
         this._acPayManager.Delete(this._acPayment.AcPaymentId);
         this._acPayment = this._acPayManager.GetNext(this._acPayment);
         if (this._acPayment == null)
         {
             this._acPayment = this._acPayManager.GetLast();
         }
     }
     catch
     {
         throw;
     }
 }
示例#14
0
 /// <summary>
 /// Update a AcPayment.
 /// </summary>
 public void Update(Model.AcPayment acPayment)
 {
     try
     {
         BL.V.BeginTransaction();
         Validate(acPayment);
         acPayment.UpdateTime = DateTime.Now;
         accessor.Update(acPayment);
         IList <Model.AcPaymentDetail> olddetail = acPaymentDetailaccessor.Select(acPayment);
         calEffect(olddetail);
         acPaymentDetailaccessor.DeleteByAcPaymentId(acPayment.AcPaymentId);
         addDetail(acPayment);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
示例#15
0
 public Model.AcPayment GetNext(Model.AcPayment e)
 {
     return(accessor.GetNext(e));
 }
示例#16
0
 public bool HasRowsAfter(Model.AcPayment e)
 {
     return(accessor.HasRowsAfter(e));
 }
示例#17
0
 public Model.AcPayment GetPrev(Model.AcPayment e)
 {
     return(accessor.GetPrev(e));
 }
示例#18
0
 public IList <Model.AcPaymentDetail> Select(Model.AcPayment acPayment)
 {
     return(accessor.Select(acPayment));
 }
示例#19
0
 public bool HasRowsBefore(Model.AcPayment e)
 {
     return(accessor.HasRowsBefore(e));
 }
示例#20
0
 public void Insert(Model.AcPayment e)
 {
     this.Insert <Model.AcPayment>(e);
 }
示例#21
0
        public XR(string AcPaymentId)
        {
            InitializeComponent();
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = "¸¶¿î½YËã";
            this.xrLabelPrintDate.Text       = DateTime.Now.ToShortDateString();

            this.AcPayment = this.AcPaymentManager.Get(AcPaymentId);

            if (this.AcPayment == null)
            {
                return;
            }

            this.AcPayment.Detail = this.AcPaymentDetailManager.Select(this.AcPayment);

            this.DataSource = this.AcPayment.Detail;
            this.xrLabelAcPaymentId.Text   = this.AcPayment.AcPaymentId;
            this.xrLabelAcPaymentDate.Text = this.AcPayment.AcPaymentDate.Value.ToString("yyyy-MM-dd");
            if (this.AcPayment.Subject != null)
            {
                this.xrLabelSubjectId.Text = this.AcPayment.Subject.SubjectName;
            }
            if (this.AcPayment.Supplier != null)
            {
                this.xrLabelSupplierId.Text = this.AcPayment.Supplier.SupplierShortName;
            }
            if (this.AcPayment.AtCurrencyCategory != null)
            {
                this.xrLabelAtCurrencyCategoryId.Text = this.AcPayment.AtCurrencyCategory.AtCurrencyName;
            }
            if (this.AcPayment.PayMethod != null)
            {
                this.xrLabelPayMethodId.Text = this.AcPayment.PayMethod.PayMethodName;
            }
            if (this.AcPayment.Employee0 != null)
            {
                this.xrLabelEmployee0Id.Text = this.AcPayment.Employee0.EmployeeName;
            }
            if (this.AcPayment.Employee != null)
            {
                this.xrLabelEmployeeId.Text = this.AcPayment.Employee.EmployeeName;
            }
            if (this.AcPayment.Employee1 != null)
            {
                this.xrLabelEmployee1Id.Text = this.AcPayment.Employee1.EmployeeName;
            }

            this.xrLabelDomesticCashAgio.Text       = this.AcPayment.DomesticCashAgio.ToString();
            this.xrLabelDomesticEealityPayment.Text = this.AcPayment.DomesticEealityPayment.ToString();
            this.xrLabelDomesticMayChargeMoney.Text = this.AcPayment.DomesticMayChargeMoney.ToString();
            this.xrLabelEealityPayment.Text         = this.AcPayment.EealityPayment.ToString();

            this.xrLabelSubscriptionAdvancePayment.Text = this.AcPayment.SubscriptionAdvancePayment.ToString();
            this.xrLabelAcDesc.Text = this.AcPayment.AcDesc;
            this.xrLabelAdvancePaymentBalance.Text = this.AcPayment.AdvancePaymentBalance.ToString();

            this.xrLabelBankAccount.Text = this.AcPayment.BankAccount;
            this.xrLabelBillNo.Text      = this.AcPayment.BillNo;


            //Ã÷ϸ
            this.xrTableAcInvoiceId.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_AcInvoiceId);
            this.xrTableAcInvoiceType.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_AcInvoiceType);

            this.xrTableDetailCashAgio.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_DetailCashAgio, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableDomesticDetailCashAgio.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_DomesticDetailCashAgio, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));

            this.xrTableDomesticNoPaymentMoney.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_DomesticNoPaymentMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableDomesticShouldPaymentMoney.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_DomesticShouldPaymentMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));

            this.xrTableDomesticThisChargeMoney.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_DomesticThisChargeMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableNoPaymentMoney.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_NoPaymentMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableShouldPaymentMoney.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_ShouldPaymentMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));

            this.xrTableThisChargeMoney.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_ThisChargeMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableBillId.DataBindings.Add("Text", this.DataSource, Model.AcPaymentDetail.PRO_BillId);
        }
示例#22
0
 public void Update(Model.AcPayment e)
 {
     this.Update <Model.AcPayment>(e);
 }
示例#23
0
 protected override void MoveFirst()
 {
     this._acPayment = this._acPayManager.Get(this._acPayManager.GetFirst() == null ? "" : this._acPayManager.GetFirst().AcPaymentId);
 }
示例#24
0
 public bool HasRowsBefore(Model.AcPayment e)
 {
     return(sqlmapper.QueryForObject <bool>("AcPayment.has_rows_before", e));
 }
示例#25
0
 public bool HasRowsAfter(Model.AcPayment e)
 {
     return(sqlmapper.QueryForObject <bool>("AcPayment.has_rows_after", e));
 }
示例#26
0
 public Model.AcPayment GetNext(Model.AcPayment e)
 {
     return(sqlmapper.QueryForObject <Model.AcPayment>("AcPayment.get_next", e));
 }
示例#27
0
 public IList <Model.AcPaymentDetail> Select(Model.AcPayment acPayment)
 {
     return(sqlmapper.QueryForList <Model.AcPaymentDetail>("AcPaymentDetail.selectByAcPayment", acPayment.AcPaymentId));
 }
示例#28
0
 public Model.AcPayment GetPrev(Model.AcPayment e)
 {
     return(sqlmapper.QueryForObject <Model.AcPayment>("AcPayment.get_prev", e));
 }