示例#1
0
        private void _Insert(Model.InvoiceQI invoice)
        {
            _ValidateForInsert(invoice);

            invoice.Employee0Id = invoice.Employee0.EmployeeId;
            invoice.AccountId   = invoice.Account.AccountId;

            invoice.Employee1Id = invoice.Employee1.EmployeeId;


            if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal)
            {
                //过账人
                invoice.Employee2Id = invoice.Employee2.EmployeeId;
                //过账时间
                invoice.InvoiceGZTime = DateTime.Now;
            }
            accessor.Insert(invoice);

            foreach (Model.InvoiceQIDetail detail in invoice.Details)
            {
                detail.InvoiceId = invoice.InvoiceId;
                invoiceQIDetailAccessor.Insert(detail);
            }

            if ((Helper.InvoiceStatus)invoice.InvoiceStatus.Value == Helper.InvoiceStatus.Normal)
            {
                Model.Account account = invoice.Account;
                account.AccountBalance1 += invoice.InvoiceTotal;
                accountAccessor.Update(account);
            }
        }
示例#2
0
        protected override void AddNew()
        {
            this.invoice = new Model.InvoiceQI();

            this.invoice.InvoiceId   = this.invoiceManager.GetNewId();
            this.invoice.InvoiceDate = DateTime.Now;
            this.invoice.Details     = new List <Model.InvoiceQIDetail>();
        }
示例#3
0
 public ViewForm(Model.InvoiceQI invoiceQi)
     : this()
 {
     if (invoiceQi == null)
     {
         throw new ArithmeticException("invoiceQi");
     }
     this.invoice = invoiceQi;
 }
示例#4
0
 public ViewForm(string invoiceId)
     : this()
 {
     this.invoice = this.invoiceQIManager.Get(invoiceId);
     if (this.invoice == null)
     {
         throw new ArithmeticException("invoiceId");
     }
 }
示例#5
0
        protected override void MovePrev()
        {
            Model.InvoiceQI invoice = this.invoiceManager.GetPrev(this.invoice);
            if (invoice == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
        }
示例#6
0
 public EditForm(string invoiceId)
     : this()
 {
     this.invoice = this.invoiceManager.Get(invoiceId);
     if (this.invoice == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.action = "update";
 }
示例#7
0
 public EditForm(Model.InvoiceQI invoiceQi)
     : this()
 {
     if (invoiceQi == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.invoice = invoiceQi;
     this.action  = "update";
 }
示例#8
0
        protected override Form GetViewForm()
        {
            Model.InvoiceQI invoice = this.SelectedItem as Model.InvoiceQI;
            if (invoice != null)
            {
                return(new ViewForm(invoice.InvoiceId));
            }

            return(null);
        }
示例#9
0
        private void Validate(Model.InvoiceQI invoice)
        {
            if (invoice.Account == null)
            {
                throw new Helper.RequireValueException("Account");
            }

            if (invoice.Details.Count == 0)
            {
                throw new Helper.RequireValueException("Details");
            }
        }
示例#10
0
        protected override void TurnNull()
        {
            if (this.invoice == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }

            this.invoiceManager.TurnNull(this.invoice.InvoiceId);
            this.invoice = this.invoiceManager.GetNext(this.invoice);
            if (this.invoice == null)
            {
                this.invoice = this.invoiceManager.GetLast();
            }
        }
示例#11
0
        public R01(string invoiceId)
        {
            InitializeComponent();

            this.invoice = this.invoiceManager.Get(invoiceId);

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

            this.invoice.Details = this.invoiceDetailManager.Select(this.invoice);

            this.DataSource = this.invoice.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoAddress.Text  = BL.Settings.CompanyAddress1;
            this.xrLabelCompanyInfoFAX.Text      = BL.Settings.CompanyFax;
            this.xrLabelCompanyInfoName.Text     = BL.Settings.CompanyChineseName + Properties.Resources.InvoiceQI;
            this.xrLabelCompanyInfoTelphone.Text = BL.Settings.CompanyPhone;

            //每页合计统计
            this.xrLabelPateTotal.Summary.Running          = SummaryRunning.Page;
            this.xrLabelPateTotal.Summary.Func             = SummaryFunc.Sum;
            this.xrLabelPateTotal.Summary.FormatString     = "{0:0}";
            this.xrLabelPateTotal.Summary.IgnoreNullValues = true;
            this.xrLabelPateTotal.DataBindings.Add("Text", this.DataSource, Model.InvoiceQIDetail.PROPERTY_INVOICEQIDETAILMONEY, "{0:0}");


            this.xrLabelAccount.Text     = this.invoice.Account.AccountName;
            this.xrLabelInvoiceDate.Text = this.invoice.InvoiceDate.Value.ToString("yyyy-MM-dd");
            this.xrLabelInvoiceId.Text   = this.invoice.InvoiceId;
            this.xrLabelNote.Text        = this.invoice.InvoiceNote;

            this.xrLabelTotal.Summary.Running          = SummaryRunning.Report;
            this.xrLabelTotal.Summary.Func             = SummaryFunc.Sum;
            this.xrLabelTotal.Summary.FormatString     = "{0:0}";
            this.xrLabelTotal.Summary.IgnoreNullValues = true;
            this.xrLabelTotal.DataBindings.Add("Text", this.DataSource, Model.InvoiceQIDetail.PROPERTY_INVOICEQIDETAILMONEY, "{0:0}");

            this.xrTableCellKind.DataBindings.Add("Text", this.DataSource, "IncomingKind." + Model.IncomingKind.PROPERTY_INCOMINGKINDNAME);
            this.xrTableCellMoney.DataBindings.Add("Text", this.DataSource, Model.InvoiceQIDetail.PROPERTY_INVOICEQIDETAILMONEY, "{0:0}");
            this.xrTableCellNote.DataBindings.Add("Text", this.DataSource, Model.InvoiceQIDetail.PROPERTY_INVOICEQIDETAILNOTE);
        }
示例#12
0
 public bool HasRowsAfter(Model.InvoiceQI e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceQI.has_rows_after", e));
 }
示例#13
0
 public Model.InvoiceQI GetNext(Model.InvoiceQI e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceQI>("InvoiceQI.get_next", e));
 }
示例#14
0
        public override void Refresh()
        {
            if (this.invoice == null)
            {
                this.invoice = new Book.Model.InvoiceQI();
                this.action  = "insert";
            }
            this.textEditInvoiceId.EditValue  = this.invoice.InvoiceId;
            this.dateEditInvoiceDate.DateTime = this.invoice.InvoiceDate.Value;

            //this.textEditAbstract.EditValue = this.invoice.InvoiceAbstract;
            this.textEditNote.EditValue = this.invoice.InvoiceNote;

            this.buttonEditEmployee.EditValue = this.invoice.Employee0;
            this.buttonEditAccount.EditValue  = this.invoice.Account;

            this.EmpAudit.EditValue      = this.invoice.AuditEmp;
            this.textEditAuditState.Text = this.invoice.AuditStateName;

            this.bindingSource1.DataSource = this.invoice.Details;

            switch (this.action)
            {
            case "insert":
                this.textEditInvoiceId.Properties.ReadOnly             = false;
                this.dateEditInvoiceDate.Properties.ReadOnly           = false;
                this.dateEditInvoiceDate.Properties.Buttons[0].Visible = true;

                //this.textEditAbstract.Properties.ReadOnly = false;
                this.textEditNote.Properties.ReadOnly = false;

                this.buttonEditEmployee.ButtonReadOnly = false;
                this.buttonEditAccount.ButtonReadOnly  = false;

                this.buttonEditEmployee.ShowButton = true;
                this.buttonEditAccount.ShowButton  = true;

                this.gridView1.OptionsBehavior.Editable = true;
                break;

            case "update":
                this.textEditInvoiceId.Properties.ReadOnly             = true;
                this.dateEditInvoiceDate.Properties.ReadOnly           = true;
                this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false;

                //this.textEditAbstract.Properties.ReadOnly = false;
                this.textEditNote.Properties.ReadOnly = false;

                this.buttonEditEmployee.ButtonReadOnly = false;
                this.buttonEditAccount.ButtonReadOnly  = false;

                this.buttonEditEmployee.ShowButton = true;
                this.buttonEditAccount.ShowButton  = true;

                this.gridView1.OptionsBehavior.Editable = true;

                break;

            case "view":
                this.textEditInvoiceId.Properties.ReadOnly             = true;
                this.dateEditInvoiceDate.Properties.ReadOnly           = true;
                this.dateEditInvoiceDate.Properties.Buttons[0].Visible = false;

                //this.textEditAbstract.Properties.ReadOnly = true;
                this.textEditNote.Properties.ReadOnly = true;

                this.buttonEditEmployee.ButtonReadOnly = true;
                this.buttonEditAccount.ButtonReadOnly  = true;

                this.buttonEditEmployee.ShowButton = false;
                this.buttonEditAccount.ShowButton  = false;

                this.gridView1.OptionsBehavior.Editable = false;
                break;

            default:
                break;
            }

            base.Refresh();
        }
示例#15
0
 public bool HasRowsBefore(Model.InvoiceQI e)
 {
     return(accessor.HasRowsBefore(e));
 }
示例#16
0
 public bool HasRowsBefore(Model.InvoiceQI e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceQI.has_rows_before", e));
 }
示例#17
0
 public Model.InvoiceQI Get(string invoiceId)
 {
     Model.InvoiceQI invoice = accessor.Get(invoiceId);
     invoice.Details = invoiceQIDetailAccessor.Select(invoice);
     return(invoice);
 }
示例#18
0
 public Model.InvoiceQI GetNext(Model.InvoiceQI e)
 {
     return(accessor.GetNext(e));
 }
示例#19
0
 public Model.InvoiceQI GetPrev(Model.InvoiceQI e)
 {
     return(accessor.GetPrev(e));
 }
示例#20
0
 public bool HasRowsAfter(Model.InvoiceQI e)
 {
     return(accessor.HasRowsAfter(e));
 }
示例#21
0
 public void Update(Model.InvoiceQI e)
 {
     this.Update <Model.InvoiceQI>(e);
 }
示例#22
0
 protected override void MoveLast()
 {
     this.invoice = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId);
 }
示例#23
0
        private void _Update(Model.InvoiceQI invoice)
        {
            _ValidateForUpdate(invoice);

            invoice.UpdateTime  = DateTime.Now;
            invoice.Employee0Id = invoice.Employee0.EmployeeId;
            invoice.AccountId   = invoice.Account.AccountId;

            Model.InvoiceQI invoiceOriginal = this.Get(invoice.InvoiceId);

            Helper.InvoiceStatus invoiceStatus = (Helper.InvoiceStatus)invoice.InvoiceStatus.Value;

            switch ((Helper.InvoiceStatus)invoiceOriginal.InvoiceStatus)
            {
            case Helper.InvoiceStatus.Draft:
                switch (invoiceStatus)
                {
                case Helper.InvoiceStatus.Draft:

                    accessor.Update(invoice);

                    invoiceQIDetailAccessor.Delete(invoice);

                    foreach (Model.InvoiceQIDetail detail in invoice.Details)
                    {
                        detail.InvoiceId         = invoice.InvoiceId;
                        detail.InvoiceQIDetailId = Guid.NewGuid().ToString();
                        invoiceQIDetailAccessor.Insert(detail);
                    }
                    break;

                case Helper.InvoiceStatus.Normal:
                    accessor.Delete(invoiceOriginal.InvoiceId);
                    invoice.InsertTime = invoiceOriginal.InsertTime;
                    invoice.UpdateTime = DateTime.Now;
                    _Insert(invoice);
                    //accessor.Update(invoice);

                    //invoiceQIDetailAccessor.Delete(invoice);

                    //foreach (Model.InvoiceQIDetail detail in invoice.Details)
                    //{
                    //    detail.InvoiceId = invoice.InvoiceId;
                    //    detail.InvoiceQIDetailId = Guid.NewGuid().ToString();
                    //    invoiceQIDetailAccessor.Insert(detail);
                    //}

                    //Model.Account account = invoice.Account;
                    //account.AccountBalance1 += invoice.InvoiceTotal;
                    //accountAccessor.Update(account);

                    //invoice.Employee2Id = invoice.Employee2.EmployeeId;
                    //invoice.InvoiceGZTime = DateTime.Now;
                    break;

                case Helper.InvoiceStatus.Null:
                    throw new InvalidOperationException();

                default:
                    break;
                }
                break;

            case Helper.InvoiceStatus.Normal:

                switch (invoiceStatus)
                {
                case Helper.InvoiceStatus.Draft:
                    throw new InvalidOperationException();

                case Helper.InvoiceStatus.Normal:
                    invoiceOriginal.InvoiceStatus = (int)Helper.InvoiceStatus.Null;
                    _TurnNull(invoiceOriginal);
                    accessor.Delete(invoiceOriginal.InvoiceId);
                    invoice.InsertTime = invoiceOriginal.InsertTime;
                    invoice.UpdateTime = DateTime.Now;
                    _Insert(invoice);
                    //Model.Account account1 = invoiceOriginal.Account;
                    //account1.AccountBalance1 -= invoiceOriginal.InvoiceTotal;
                    //accountAccessor.Update(account1);

                    //accessor.Delete(invoiceOriginal.InvoiceId);

                    //invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal;
                    //invoice.InsertTime = invoiceOriginal.InsertTime;
                    //invoice.UpdateTime = DateTime.Now;
                    //_Insert(invoice);

                    break;

                case Helper.InvoiceStatus.Null:

                    //invoice.Employee3Id = V.ActiveEmployee.EmployeeId;
                    //invoice.InvoiceZFTime = DateTime.Now;
                    //invoice.InvoiceZFCause = "";

                    //accessor.Update(invoice);

                    Model.Account account = invoice.Account;
                    account.AccountBalance1 -= invoice.InvoiceTotal;
                    accountAccessor.Update(account);
                    break;
                }
                break;

            case Helper.InvoiceStatus.Null:
                throw new InvalidOperationException();
            }
        }
示例#24
0
 public Model.InvoiceQI GetPrev(Model.InvoiceQI e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceQI>("InvoiceQI.get_prev", e));
 }
示例#25
0
 private void _TurnNormal(Model.InvoiceQI invoice)
 {
     invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal;
     _Update(invoice);
 }
示例#26
0
 public void Insert(Model.InvoiceQI e)
 {
     this.Insert <Model.InvoiceQI>(e);
 }