Esempio n. 1
0
 public EditForm(Model.AcCollection acc, string action)
     : this()
 {
     this._acCollection = acc;
     this.action        = "view";
     LastFlag           = 1;
 }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Insert a AcCollection.
        /// </summary>
        public void Insert(Model.AcCollection acCollection)
        {
            Validate(acCollection);
            try
            {
                BL.V.BeginTransaction();
                acCollection.InsertTime = DateTime.Now;
                TiGuiExists(acCollection);


                acCollection.UpdateTime = DateTime.Now;

                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, acCollection.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, acCollection.InsertTime.Value.Year, acCollection.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, acCollection.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(acCollection);
                addDetail(acCollection);
                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
Esempio n. 4
0
 protected override void AddNew()
 {
     this._acCollection = new Model.AcCollection();
     this._acCollection.AcCollectionId = this._acCollectionManager.GetId();
     this._acCollection.Employee       = BL.V.ActiveOperator.Employee;
     this._acCollection.AcPaymentDate  = DateTime.Now;
     this._acCollection.Detail         = new List <Model.AcCollectionDetail>();
 }
Esempio n. 5
0
 protected override void MovePrev()
 {
     Model.AcCollection temp = this._acCollectionManager.GetPrev(this._acCollection);
     if (temp == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this._acCollection = this._acCollectionManager.Get(temp.AcCollectionId);
 }
Esempio n. 6
0
 protected override void MoveLast()
 {
     if (this.LastFlag == 1)
     {
         this.LastFlag = 0;
         return;
     }
     this._acCollection = this._acCollectionManager.Get(this._acCollectionManager.GetLast() == null ? "" : this._acCollectionManager.GetLast().AcCollectionId);
 }
Esempio n. 7
0
        public override void Refresh()
        {
            if (this._acCollection == null)
            {
                this.AddNew();
                this.action = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this._acCollection = this._acCollectionManager.GetDetails(this._acCollection);
                    if (this._acCollection == null)
                    {
                        this._acCollection = new Book.Model.AcCollection();
                    }
                }
            }

            this.textAcCollectionId.Text                 = this._acCollection.AcCollectionId;
            this.textAuditingState.Text                  = this.GetAuditName(this._acCollection.AuditState);
            this.textBankAccount.Text                    = this._acCollection.BankAccount;
            this.textBillNo.Text                         = this._acCollection.BillNo;
            this.calcAdvanceCollectionBalance.Value      = this._acCollection.AdvanceCollectionBalance == null ? 0 : this._acCollection.AdvanceCollectionBalance.Value;
            this.calcDomesticCashAgio.Value              = this._acCollection.DomesticCashAgio == null ? 0 : this._acCollection.DomesticCashAgio.Value;
            this.calcDomesticEealityCollection.Value     = this._acCollection.DomesticEealityCollection == null ? 0 : this._acCollection.DomesticEealityCollection.Value;
            this.calcDomesticMayChargeMoney.Value        = this._acCollection.DomesticMayChargeMoney == null ? 0 : this._acCollection.DomesticMayChargeMoney.Value;
            this.calcJoinAdvanceCollection.Value         = this._acCollection.JoinAdvanceCollection == null ? 0 : this._acCollection.JoinAdvanceCollection.Value;
            this.calcSubscriptionAdvanceCollection.Value = this._acCollection.SubscriptionAdvanceCollection == null ? 0 : this._acCollection.SubscriptionAdvanceCollection.Value;
            this.newChooseAtCurrencyCategoryId.EditValue = this._acCollection.AtCurrencyCategory;
            this.newChooseCustomerId.EditValue           = this._acCollection.Customer;
            this.newChooseEmployee0Id.EditValue          = this._acCollection.AuditEmp;
            this.newChooseEmployee1Id.EditValue          = this._acCollection.Employee1;
            this.newChooseEmployeeId.EditValue           = this._acCollection.Employee;
            this.newChoosePayMethodId.EditValue          = this._acCollection.PayMethod;
            this.newChooseSubjectId.EditValue            = this._acCollection.Subject;
            this.dateAcPaymentDate.Text                  = this._acCollection.AcPaymentDate == null ? "" : this._acCollection.AcPaymentDate.Value.ToString();
            this.memoAcDesc.Text                         = this._acCollection.AcDesc;

            this.bindingSourceDetails.DataSource = this._acCollection.Detail;
            this.gridView1.GroupPanelText        = "共: " + (this._acCollection.Detail == null ? "0" : this._acCollection.Detail.Count.ToString()) + " 項";
            base.Refresh();

            if (this.action == "view")
            {
                this.barBtnInvoiceXO.Enabled = false;
            }
            else
            {
                this.barBtnInvoiceXO.Enabled = true;
            }
            this.textAcCollectionId.Enabled           = false;
            this.newChooseEmployeeId.Enabled          = false;
            this.calcAdvanceCollectionBalance.Enabled = false;
            this.calcDomesticCashAgio.Enabled         = false;
            this.calcDomesticMayChargeMoney.Enabled   = false;
        }
Esempio n. 8
0
 public Model.AcCollection GetDetails(Model.AcCollection acCollection)
 {
     Model.AcCollection temp = accessor.Get(acCollection.AcCollectionId);
     if (temp != null)
     {
         temp.Detail = acCollectionDetailaccessor.Select(temp);
     }
     return(temp);
 }
Esempio n. 9
0
 public void Delete(Model.AcCollection acc)
 {
     try
     {
         BL.V.BeginTransaction();
         calEffect(acc.Detail);
         acCollectionDetailaccessor.DeleteByAccid(acc.AcCollectionId);
         this.Delete(acc.AcCollectionId);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Esempio n. 10
0
 private void TiGuiExists(Model.AcCollection model)
 {
     if (this.ExistsPrimary(model.AcCollectionId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.AcPaymentDate.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.AcPaymentDate.Value.Year, model.AcPaymentDate.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.AcPaymentDate.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.AcCollectionId = this.GetId(model.AcPaymentDate.Value);
         TiGuiExists(model);
         //throw new Helper.InvalidValueException(Model.Product.PRO_Id);
     }
 }
Esempio n. 11
0
 protected override void Delete()
 {
     if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
     {
         return;
     }
     try
     {
         this._acCollectionManager.Delete(this._acCollection);
         this._acCollection = this._acCollectionManager.GetNext(this._acCollection);
         if (this._acCollection == null)
         {
             this._acCollection = this._acCollectionManager.GetLast();
         }
     }
     catch
     {
         throw;
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Update a AcCollection.
 /// </summary>
 public void Update(Model.AcCollection acCollection)
 {
     try
     {
         BL.V.BeginTransaction();
         Validate(acCollection);
         acCollection.UpdateTime = DateTime.Now;
         accessor.Update(acCollection);
         IList <Model.AcCollectionDetail> olddetail = acCollectionDetailaccessor.Select(acCollection);
         calEffect(olddetail);
         acCollectionDetailaccessor.DeleteByAccid(acCollection.AcCollectionId);
         addDetail(acCollection);
         BL.V.CommitTransaction();
     }
     catch
     {
         BL.V.RollbackTransaction();
         throw;
     }
 }
Esempio n. 13
0
 private void Validate(Model.AcCollection acc)
 {
     //if (string.IsNullOrEmpty(acc.PayMethodId))
     //{
     //    throw new global::Helper.RequireValueException(Model.AcCollection.PRO_PayMethodId);
     //}
     if (string.IsNullOrEmpty(acc.CustomerId))
     {
         throw new global::Helper.RequireValueException(Model.AcCollection.PRO_CustomerId);
     }
     if (string.IsNullOrEmpty(acc.Employee1Id))
     {
         throw new global::Helper.RequireValueException(Model.AcCollection.PRO_Employee1Id);
     }
     foreach (Model.AcCollectionDetail item in acc.Detail)
     {
         if (item.DomesticNoPaymentMoney < item.DomesticThisChargeMoney)
         {
             throw new global::Helper.InvalidValueException(Model.AcCollectionDetail.PRO_DomesticThisChargeMoney);
         }
     }
 }
Esempio n. 14
0
 public IList <Model.AcCollectionDetail> Select(Model.AcCollection acCollection)
 {
     return(accessor.Select(acCollection));
 }
Esempio n. 15
0
 public Model.AcCollection GetPrev(Model.AcCollection e)
 {
     return(sqlmapper.QueryForObject <Model.AcCollection>("AcCollection.get_prev", e));
 }
Esempio n. 16
0
 public Model.AcCollection GetNext(Model.AcCollection e)
 {
     return(sqlmapper.QueryForObject <Model.AcCollection>("AcCollection.get_next", e));
 }
Esempio n. 17
0
 public bool HasRowsAfter(Model.AcCollection e)
 {
     return(sqlmapper.QueryForObject <bool>("AcCollection.has_rows_after", e));
 }
Esempio n. 18
0
 public bool HasRowsBefore(Model.AcCollection e)
 {
     return(sqlmapper.QueryForObject <bool>("AcCollection.has_rows_before", e));
 }
Esempio n. 19
0
 public void Update(Model.AcCollection e)
 {
     this.Update <Model.AcCollection>(e);
 }
Esempio n. 20
0
 public void Insert(Model.AcCollection e)
 {
     this.Insert <Model.AcCollection>(e);
 }
Esempio n. 21
0
 public Model.AcCollection GetPrev(Model.AcCollection e)
 {
     return(accessor.GetPrev(e));
 }
Esempio n. 22
0
 public Model.AcCollection GetNext(Model.AcCollection e)
 {
     return(accessor.GetNext(e));
 }
Esempio n. 23
0
 protected override void MoveFirst()
 {
     this._acCollection = this._acCollectionManager.Get(this._acCollectionManager.GetFirst() == null ? "" : this._acCollectionManager.GetFirst().AcCollectionId);
 }
Esempio n. 24
0
 public bool HasRowsAfter(Model.AcCollection e)
 {
     return(accessor.HasRowsAfter(e));
 }
Esempio n. 25
0
 public IList <Model.AcCollectionDetail> Select(Model.AcCollection acCollection)
 {
     return(sqlmapper.QueryForList <Model.AcCollectionDetail>("AcCollectionDetail.selectByAcCollection", acCollection.AcCollectionId));
 }
Esempio n. 26
0
        public XR(string AcCollectionId)
        {
            InitializeComponent();
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = "ÊÕ¿î½YËã";
            this.xrLabelPrintDate.Text       = DateTime.Now.ToShortDateString();

            this.AcCollection = this.AcCollectionManager.Get(AcCollectionId);

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

            this.AcCollection.Detail = this.AcCollectionDetailManager.Select(this.AcCollection);

            this.DataSource = this.AcCollection.Detail;
            this.xrLabelAcCollectionId.Text   = this.AcCollection.AcCollectionId;
            this.xrLabelAcCollectionDate.Text = this.AcCollection.AcPaymentDate.Value.ToString("yyyy-MM-dd");
            if (this.AcCollection.Subject != null)
            {
                this.xrLabelSubjectId.Text = this.AcCollection.Subject.SubjectName;
            }
            if (this.AcCollection.Customer != null)
            {
                this.xrLabelCustomerId.Text = this.AcCollection.Customer.CustomerShortName;
            }
            if (this.AcCollection.AtCurrencyCategory != null)
            {
                this.xrLabelAtCurrencyCategoryId.Text = this.AcCollection.AtCurrencyCategory.AtCurrencyName;
            }
            if (this.AcCollection.PayMethod != null)
            {
                this.xrLabelPayMethodId.Text = this.AcCollection.PayMethod.PayMethodName;
            }
            if (this.AcCollection.Employee0 != null)
            {
                this.xrLabelEmployee0Id.Text = this.AcCollection.Employee0.EmployeeName;
            }
            if (this.AcCollection.Employee != null)
            {
                this.xrLabelEmployeeId.Text = this.AcCollection.Employee.EmployeeName;
            }
            if (this.AcCollection.Employee1 != null)
            {
                this.xrLabelEmployee1Id.Text = this.AcCollection.Employee1.EmployeeName;
            }
            this.xrLabelDomesticCashAgio.Text           = this.AcCollection.DomesticCashAgio.ToString();
            this.xrLabelDomesticEealityPayment.Text     = this.AcCollection.DomesticEealityCollection.ToString();
            this.xrLabelDomesticMayChargeMoney.Text     = this.AcCollection.DomesticMayChargeMoney.ToString();
            this.xrLabelEealityPayment.Text             = this.AcCollection.EealityCollection.ToString();
            this.xrLabelJoinAdvancePayment.Text         = this.AcCollection.JoinAdvanceCollection.ToString();
            this.xrLabelSubscriptionAdvancePayment.Text = this.AcCollection.SubscriptionAdvanceCollection.ToString();
            this.xrLabelAcDesc.Text = this.AcCollection.AcDesc;
            this.xrLabelAdvancePaymentBalance.Text = this.AcCollection.AdvanceCollectionBalance.ToString();
            this.xrLabelAlreadyChargeMoney.Text    = this.AcCollection.AlreadyChargeMoney.ToString();
            this.xrLabelBankAccount.Text           = this.AcCollection.BankAccount;
            this.xrLabelBillNo.Text   = this.AcCollection.BillNo;
            this.xrLabelCashAgio.Text = this.AcCollection.CashAgio.ToString();

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

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

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

            this.xrTableDomesticThisChargeMoney.DataBindings.Add("Text", this.DataSource, Model.AcCollectionDetail.PRO_DomesticThisChargeMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableMayChargeMoney.DataBindings.Add("Text", this.DataSource, Model.AcCollectionDetail.PRO_MayChargeMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));

            this.xrTableNoPaymentMoney.DataBindings.Add("Text", this.DataSource, Model.AcCollectionDetail.PRO_NoCollectionMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableShouldPaymentMoney.DataBindings.Add("Text", this.DataSource, Model.AcCollectionDetail.PRO_ShouldCollectionMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));

            this.xrTableThisChargeMoney.DataBindings.Add("Text", this.DataSource, Model.AcCollectionDetail.PRO_ThisChargeMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.XSZJXiao.Value));
            this.xrTableBillId.DataBindings.Add("Text", this.DataSource, Model.AcCollectionDetail.PRO_BillId);
        }
Esempio n. 27
0
 public bool HasRowsBefore(Model.AcCollection e)
 {
     return(accessor.HasRowsBefore(e));
 }