예제 #1
0
 protected override void MoveLast()
 {
     if (LastFlag == 1)
     {
         LastFlag = 0; return;
     }
     this.invoice = this.invoiceManager.Get(this.invoiceManager.GetLast() == null ? "" : this.invoiceManager.GetLast().InvoiceId);
 }
예제 #2
0
 public ViewForm(Model.InvoiceCJ invoicecj)
     : this()
 {
     if (invoicecj == null)
     {
         throw new ArithmeticException("invoiceid");
     }
     this.invoice = invoicecj;
 }
예제 #3
0
 public ViewForm(string invoiceId)
     : this()
 {
     this.invoice = this.invoiceCJManager.Get(invoiceId);
     if (this.invoice == null)
     {
         throw new ArithmeticException("invoiceid");
     }
 }
예제 #4
0
        protected override void MovePrev()
        {
            Model.InvoiceCJ invoice = this.invoiceManager.GetPrev(this.invoice);
            if (invoice == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
        }
예제 #5
0
        protected override Form GetViewForm()
        {
            Model.InvoiceCJ invoice = this.SelectedItem as Model.InvoiceCJ;
            if (invoice != null)
            {
                return(new ViewForm(invoice.InvoiceId));
            }

            return(null);
        }
예제 #6
0
        int LastFlag = 0; //页面载入时是否执行 last方法
        public EditForm(string invoiceId)
            : this()
        {
            this.invoice = this.invoiceManager.Get(invoiceId);
            if (this.invoice == null)
            {
                throw new ArithmeticException("invoiceid");
            }

            this.action = "view";
            if (this.action == "view")
            {
                LastFlag = 1;
            }
        }
예제 #7
0
        public EditForm(Model.InvoiceCJ invoicecj)
            : this()
        {
            if (invoicecj == null)
            {
                throw new ArithmeticException("invoiceid");
            }
            this.invoice = invoicecj;

            this.action = "view";
            if (this.action == "view")
            {
                LastFlag = 1;
            }
        }
예제 #8
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();
            }
        }
예제 #9
0
        private void Validate(Model.InvoiceCJ invoice)
        {
            if (string.IsNullOrEmpty(invoice.InvoiceId))
            {
                throw new Helper.RequireValueException("Id");
            }

            if (invoice.Employee0 == null)
            {
                throw new Helper.RequireValueException("Employee0");
            }

            if (invoice.Supplier == null)
            {
                throw new Helper.RequireValueException("Company");
            }

            if (invoice.Details.Count == 0)
            {
                throw new Helper.RequireValueException("Details");
            }
            else
            {
                if (string.IsNullOrEmpty(invoice.Details[0].ProductId))
                {
                    if (invoice.Details.Count <= 1)
                    {
                        throw new Helper.RequireValueException("Details");
                    }
                }
            }

            foreach (Model.InvoiceCJDetail detail in invoice.Details)
            {
                if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId))
                {
                    continue;
                }
                if (detail.InvoiceCJDetailMoney == 0)
                {
                    throw new Helper.RequireValueException("Price");
                }
            }
        }
예제 #10
0
        public R01(string invoiceid)
        {
            InitializeComponent();

            this.invoice = this.invoiceCGManager.Get(invoiceid);

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

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

            this.DataSource = this.invoice.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelData.Text            = Properties.Resources.InvoiceCJ;
            this.xrLabelPrintDate.Text      += DateTime.Now.ToShortDateString();
            //客户信息
            this.xrLabelCustomName.Text  = this.invoice.Supplier.SupplierShortName;
            this.xrLabelLianluoName.Text = this.invoice.Supplier.SupplierManager;
            this.xrLabelCustomFax.Text   = this.invoice.Supplier.SupplierFax;
            this.xrLabelCustomTel.Text   = string.IsNullOrEmpty(this.invoice.Supplier.SupplierPhone1) ? this.invoice.Supplier.SupplierPhone2 : this.invoice.Supplier.SupplierPhone1;
            this.xrLabelTongYiNo.Text    = this.invoice.Supplier.SupplierNumber;

            //单据信息
            this.xrLabelInvoiceDate.Text = this.invoice.InvoiceDate.Value.ToString("yyyy-MM-dd");
            this.xrLabelInvoiceId.Text   = this.invoice.InvoiceId;
            this.xrLabelYeWuName.Text    = this.invoice.Employee0.EmployeeName + this.invoice.Employee0Id;
            this.xrLabelTotal1.Text      = global::Helper.DateTimeParse.GetSiSheWuRu(this.invoice.InvoiceTotal.Value, BL.V.SetDataFormat.CGZJXiao.Value).ToString();
            this.xrLabelNote.Text        = this.invoice.InvoiceNote;
            this.xrLabel25.Text         += this.invoice.AuditEmp == null ? "" : this.invoice.AuditEmp.EmployeeName;

            //明细信息
            this.xrTableCellProductId.DataBindings.Add("Text", this.DataSource, Model.InvoiceCJDetail.PRO_Inumber);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            //this.xrTableCellProductGuige.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductSpecification);
            this.xrTableCellProductUnit.DataBindings.Add("Text", this.DataSource, Model.InvoiceCJDetail.PRO_InvoiceCJDetailQuantity);
            this.xrTableCellQuantity.DataBindings.Add("Text", this.DataSource, Model.InvoiceCJDetail.PRO_InvoiceProductUnit);
            this.xrTableCellUintPrice.DataBindings.Add("Text", this.DataSource, Model.InvoiceCJDetail.PRO_InvoiceCJDetailPrice, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.CGDJXiao.Value));
            this.xrTableCellMoney.DataBindings.Add("Text", this.DataSource, Model.InvoiceCJDetail.PRO_InvoiceCJDetailMoney, global::Helper.DateTimeParse.GetFormatA(BL.V.SetDataFormat.CGJEXiao.Value));
        }
예제 #11
0
 protected override void AddNew()
 {
     this.invoice             = new Model.InvoiceCJ();
     this.invoice.InvoiceId   = this.invoiceManager.GetNewId();
     this.invoice.InvoiceDate = DateTime.Now;
     this.invoice.Details     = new List <Model.InvoiceCJDetail>();
     if (this.action == "insert")
     {
         Model.InvoiceCJDetail detail = new Model.InvoiceCJDetail();
         detail.Inumber                 = this.invoice.Details.Count + 1;
         detail.InvoiceCJDetailId       = Guid.NewGuid().ToString();
         detail.InvoiceCJDetailMoney    = 0;
         detail.InvoiceCJDetailNote     = "";
         detail.InvoiceCJDetailPrice    = 0;
         detail.InvoiceCJDetailQuantity = 0;
         detail.InvoiceProductUnit      = "";
         detail.Product                 = new Book.Model.Product();
         this.invoice.Details.Add(detail);
         this.bindingSource1.Position = this.bindingSource1.IndexOf(detail);
     }
 }
예제 #12
0
        private void _Insert(Model.InvoiceCJ invoice)
        {
            _ValidateForInsert(invoice);

            invoice.InsertTime    = DateTime.Now;
            invoice.UpdateTime    = DateTime.Now;
            invoice.Employee0Id   = invoice.Employee0.EmployeeId;
            invoice.SupplierId    = invoice.Supplier.SupplierId;
            invoice.Employee1Id   = invoice.Employee0Id;
            invoice.Employee2Id   = null;
            invoice.InvoiceGZTime = DateTime.Now;
            accessor.Insert(invoice);

            foreach (Model.InvoiceCJDetail detail in invoice.Details)
            {
                if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId))
                {
                    continue;
                }
                detail.InvoiceId = invoice.InvoiceId;
                invoiceCJDetailAccessor.Insert(detail);
            }
        }
예제 #13
0
 public void Update(Model.InvoiceCJ e)
 {
     this.Update <Model.InvoiceCJ>(e);
 }
예제 #14
0
 public void Insert(Model.InvoiceCJ e)
 {
     this.Insert <Model.InvoiceCJ>(e);
 }
예제 #15
0
 public Model.InvoiceCJ GetPrev(Model.InvoiceCJ e)
 {
     return(accessor.GetPrev(e));
 }
예제 #16
0
 public Model.InvoiceCJ GetNext(Model.InvoiceCJ e)
 {
     return(accessor.GetNext(e));
 }
예제 #17
0
        public override void Refresh()
        {
            gridView1.IndicatorWidth = 30;
            if (this.invoice == null)
            {
                this.invoice = new Book.Model.InvoiceCJ();
                this.action  = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this.invoice = this.invoiceManager.Get(invoice.InvoiceId);
                }
            }
            this.textEditInvoiceId.EditValue   = this.invoice.InvoiceId;
            this.dateEditInvoiceDate.EditValue = this.invoice.InvoiceDate;
            this.buttonEditEmployee.EditValue  = this.invoice.Employee0;
            this.buttonEditCompany.EditValue   = this.invoice.Supplier;
            //this.textEditAbstract.EditValue = this.invoice.InvoiceAbstract;
            this.textEditNote.EditValue  = this.invoice.InvoiceNote;
            this.calcEditTotal.EditValue = this.invoice.InvoiceTotal;

            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.barButtonItemGeneral.Enabled = false;

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

                this.buttonEditCompany.ShowButton  = true;
                this.buttonEditEmployee.ShowButton = true;

                this.buttonEditCompany.ButtonReadOnly  = false;
                this.buttonEditEmployee.ButtonReadOnly = false;

                this.gridView1.OptionsBehavior.Editable = true;

                this.simpleButtonAppend.Enabled = true;
                this.simpleButtonRemove.Enabled = true;
                break;

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

                this.barButtonItemGeneral.Enabled = false;

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

                this.buttonEditCompany.ShowButton  = true;
                this.buttonEditEmployee.ShowButton = true;

                this.buttonEditCompany.ButtonReadOnly  = false;
                this.buttonEditEmployee.ButtonReadOnly = false;

                this.gridView1.OptionsBehavior.Editable = true;

                this.simpleButtonAppend.Enabled = true;
                this.simpleButtonRemove.Enabled = true;
                break;

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

                this.barButtonItemGeneral.Enabled = true;

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

                this.buttonEditCompany.ShowButton  = false;
                this.buttonEditEmployee.ShowButton = false;

                this.buttonEditCompany.ButtonReadOnly  = true;
                this.buttonEditEmployee.ButtonReadOnly = true;

                this.gridView1.OptionsBehavior.Editable = false;

                this.simpleButtonAppend.Enabled = false;
                this.simpleButtonRemove.Enabled = false;
                break;

            default:
                break;
            }

            base.Refresh();
            this.textEditInvoiceId.Properties.ReadOnly = true;
        }
예제 #18
0
        private void _Update(Model.InvoiceCJ invoice)
        {
            _ValidateForUpdate(invoice);

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

            switch ((Helper.InvoiceStatus)invoiceOriginal.InvoiceStatus)
            {
            case Helper.InvoiceStatus.Draft:
                switch ((Helper.InvoiceStatus)invoice.InvoiceStatus)
                {
                    #region Draft
                case Helper.InvoiceStatus.Draft:

                    invoice.UpdateTime  = DateTime.Now;
                    invoice.Employee0Id = invoice.Employee0.EmployeeId;
                    invoice.SupplierId  = invoice.Supplier.SupplierId;
                    accessor.Update(invoice);

                    invoiceCJDetailAccessor.Delete(invoice);
                    foreach (Model.InvoiceCJDetail detail in invoice.Details)
                    {
                        if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId))
                        {
                            continue;
                        }
                        detail.InvoiceId         = invoice.InvoiceId;
                        detail.InvoiceCJDetailId = Guid.NewGuid().ToString();
                        invoiceCJDetailAccessor.Insert(detail);
                    }
                    break;

                    #endregion
                    #region Normal
                case Helper.InvoiceStatus.Normal:

                    accessor.Delete(invoice.InvoiceId);

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

                    _Insert(invoice);
                    break;

                    #endregion
                case Helper.InvoiceStatus.Null:
                    throw new InvalidOperationException();
                }
                break;

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

                case Helper.InvoiceStatus.Normal:

                    invoice.UpdateTime  = DateTime.Now;
                    invoice.Employee0Id = invoice.Employee0.EmployeeId;
                    invoice.SupplierId  = invoice.Supplier.SupplierId;

                    accessor.Update(invoice);

                    invoiceCJDetailAccessor.Delete(invoice);

                    foreach (Model.InvoiceCJDetail detail in invoice.Details)
                    {
                        if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId))
                        {
                            continue;
                        }
                        detail.InvoiceId         = invoice.InvoiceId;
                        detail.InvoiceCJDetailId = Guid.NewGuid().ToString();
                        invoiceCJDetailAccessor.Insert(detail);
                    }

                    break;

                case Helper.InvoiceStatus.Null:

                    invoice.UpdateTime    = DateTime.Now;
                    invoice.Employee3Id   = null;
                    invoice.InvoiceZFTime = DateTime.Now;
                    accessor.Update(invoice);

                    foreach (Model.InvoiceCJDetail detail in invoice.Details)
                    {
                        if (detail.Product == null || string.IsNullOrEmpty(detail.Product.ProductId))
                        {
                            continue;
                        }
                        invoiceCJDetailAccessor.Update(detail);
                    }
                    break;
                }
                break;

            case Helper.InvoiceStatus.Null:
                throw new InvalidOperationException();
            }
        }
예제 #19
0
 /// <summary>
 /// Select by primary key.
 /// </summary>
 public Model.InvoiceCJ Get(string invoiceId)
 {
     Model.InvoiceCJ invoice = accessor.Get(invoiceId);
     invoice.Details = invoiceCJDetailAccessor.Select(invoice);
     return(invoice);
 }
예제 #20
0
 public bool HasRowsAfter(Model.InvoiceCJ e)
 {
     return(accessor.HasRowsAfter(e));
 }
예제 #21
0
 public Model.InvoiceCJ GetNext(Model.InvoiceCJ e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceCJ>("InvoiceCJ.get_next", e));
 }
예제 #22
0
 public bool HasRowsBefore(Model.InvoiceCJ e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceCJ.has_rows_before", e));
 }
예제 #23
0
 protected override void MoveFirst()
 {
     this.invoice = this.invoiceManager.Get(this.invoiceManager.GetFirst() == null ? "" : this.invoiceManager.GetFirst().InvoiceId);
 }
예제 #24
0
 public bool HasRowsAfter(Model.InvoiceCJ e)
 {
     return(sqlmapper.QueryForObject <bool>("InvoiceCJ.has_rows_after", e));
 }
예제 #25
0
 private void _TurnNormal(Model.InvoiceCJ invoice)
 {
     invoice.InvoiceStatus = (int)Helper.InvoiceStatus.Normal;
     _Update(invoice);
 }
예제 #26
0
 public Model.InvoiceCJ GetPrev(Model.InvoiceCJ e)
 {
     return(sqlmapper.QueryForObject <Model.InvoiceCJ>("InvoiceCJ.get_prev", e));
 }
예제 #27
0
 public bool HasRowsBefore(Model.InvoiceCJ e)
 {
     return(accessor.HasRowsBefore(e));
 }