/// <summary>
        /// This method will return an object representing the record matching the primary key information specified.
        /// </summary>
        ///
        /// <param name="pk" type="PURPurchaseHeaderPrimaryKey">Primary Key information based on which data is to be fetched.</param>
        ///
        /// <returns>object of class PURPurchaseHeader</returns>
        public PURPurchaseHeader SelectOne(PURPurchaseHeaderPrimaryKey pk)
        {
            _pURPurchaseHeaderWCF = new PURPurchaseHeader();
            _pURPurchaseHeader    = POS.DataLayer.PURPurchaseHeaderBase.SelectOne(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pk.PurcaseHeaderID));

            _pURPurchaseHeaderWCF.PurcaseHeaderID     = _pURPurchaseHeader.PurcaseHeaderID;
            _pURPurchaseHeaderWCF.PurchaseDate        = _pURPurchaseHeader.PurchaseDate;
            _pURPurchaseHeaderWCF.PaymentTypeID       = _pURPurchaseHeader.PaymentTypeID;
            _pURPurchaseHeaderWCF.SupplierID          = _pURPurchaseHeader.SupplierID;
            _pURPurchaseHeaderWCF.InvoiceNumber       = _pURPurchaseHeader.InvoiceNumber;
            _pURPurchaseHeaderWCF.CreateDate          = _pURPurchaseHeader.CreateDate;
            _pURPurchaseHeaderWCF.CreatedBy           = _pURPurchaseHeader.CreatedBy;
            _pURPurchaseHeaderWCF.updateDate          = _pURPurchaseHeader.updateDate;
            _pURPurchaseHeaderWCF.UpdatedBy           = _pURPurchaseHeader.UpdatedBy;
            _pURPurchaseHeaderWCF.IsDeleted           = _pURPurchaseHeader.IsDeleted;
            _pURPurchaseHeaderWCF.DeleteDate          = _pURPurchaseHeader.DeleteDate;
            _pURPurchaseHeaderWCF.TotalPrice          = _pURPurchaseHeader.TotalPrice;
            _pURPurchaseHeaderWCF.ServicePrice        = _pURPurchaseHeader.ServicePrice;
            _pURPurchaseHeaderWCF.PaidAmount          = _pURPurchaseHeader.PaidAmount;
            _pURPurchaseHeaderWCF.IsClosed            = _pURPurchaseHeader.IsClosed;
            _pURPurchaseHeaderWCF.IsVoid              = _pURPurchaseHeader.IsVoid;
            _pURPurchaseHeaderWCF.IsPrinted           = _pURPurchaseHeader.IsPrinted;
            _pURPurchaseHeaderWCF.RefuseReasonID      = _pURPurchaseHeader.RefuseReasonID;
            _pURPurchaseHeaderWCF.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
            _pURPurchaseHeaderWCF.TotalDiscountRatio  = _pURPurchaseHeader.TotalDiscountRatio;
            _pURPurchaseHeaderWCF.TaxTypeID           = _pURPurchaseHeader.TaxTypeID;
            _pURPurchaseHeaderWCF.RemainingAmount     = _pURPurchaseHeader.RemainingAmount;
            _pURPurchaseHeaderWCF.LastDayToPay        = _pURPurchaseHeader.LastDayToPay;
            _pURPurchaseHeaderWCF.DeletedBy           = _pURPurchaseHeader.DeletedBy;
            _pURPurchaseHeaderWCF.Notes       = _pURPurchaseHeader.Notes;
            _pURPurchaseHeaderWCF.InventoryID = _pURPurchaseHeader.InventoryID;
            _pURPurchaseHeaderWCF.InvoiceDate = _pURPurchaseHeader.InvoiceDate;

            return(_pURPurchaseHeaderWCF);
        }
        ///<summary>
        /// This method will update one new row into the database using the property Information
        /// </summary>
        ///
        /// <param name="pURPurchaseHeader" type="PURPurchaseHeader">This PURPurchaseHeader  will be updated in the database.</param>
        ///
        /// <returns>True if succeeded</returns>
        public bool Update(PURPurchaseHeader pURPurchaseHeader)
        {
            _pURPurchaseHeader = POS.DataLayer.PURPurchaseHeader.SelectOne(new POS.DataLayer.PURPurchaseHeaderPrimaryKey(pURPurchaseHeader.PurcaseHeaderID));

            _pURPurchaseHeader.PurchaseDate        = pURPurchaseHeader.PurchaseDate;
            _pURPurchaseHeader.PaymentTypeID       = pURPurchaseHeader.PaymentTypeID;
            _pURPurchaseHeader.SupplierID          = pURPurchaseHeader.SupplierID;
            _pURPurchaseHeader.InvoiceNumber       = pURPurchaseHeader.InvoiceNumber;
            _pURPurchaseHeader.CreateDate          = pURPurchaseHeader.CreateDate;
            _pURPurchaseHeader.CreatedBy           = pURPurchaseHeader.CreatedBy;
            _pURPurchaseHeader.updateDate          = pURPurchaseHeader.updateDate;
            _pURPurchaseHeader.UpdatedBy           = pURPurchaseHeader.UpdatedBy;
            _pURPurchaseHeader.IsDeleted           = pURPurchaseHeader.IsDeleted;
            _pURPurchaseHeader.DeleteDate          = pURPurchaseHeader.DeleteDate;
            _pURPurchaseHeader.TotalPrice          = pURPurchaseHeader.TotalPrice;
            _pURPurchaseHeader.ServicePrice        = pURPurchaseHeader.ServicePrice;
            _pURPurchaseHeader.PaidAmount          = pURPurchaseHeader.PaidAmount;
            _pURPurchaseHeader.IsClosed            = pURPurchaseHeader.IsClosed;
            _pURPurchaseHeader.IsVoid              = pURPurchaseHeader.IsVoid;
            _pURPurchaseHeader.IsPrinted           = pURPurchaseHeader.IsPrinted;
            _pURPurchaseHeader.RefuseReasonID      = pURPurchaseHeader.RefuseReasonID;
            _pURPurchaseHeader.TotalDiscountAmount = pURPurchaseHeader.TotalDiscountAmount;
            _pURPurchaseHeader.TotalDiscountRatio  = pURPurchaseHeader.TotalDiscountRatio;
            _pURPurchaseHeader.TaxTypeID           = pURPurchaseHeader.TaxTypeID;
            _pURPurchaseHeader.RemainingAmount     = pURPurchaseHeader.RemainingAmount;
            _pURPurchaseHeader.LastDayToPay        = pURPurchaseHeader.LastDayToPay;
            _pURPurchaseHeader.DeletedBy           = pURPurchaseHeader.DeletedBy;
            _pURPurchaseHeader.Notes       = pURPurchaseHeader.Notes;
            _pURPurchaseHeader.InventoryID = pURPurchaseHeader.InventoryID;
            _pURPurchaseHeader.InvoiceDate = pURPurchaseHeader.InvoiceDate;

            return(_pURPurchaseHeader.Update());
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method will return a list of objects representing all records in the table.
        /// </summary>
        ///
        /// <returns>list of objects of class PURPurchaseHeader in the form of object of PURPurchaseHeaderCollection </returns>
        public PURPurchaseHeaderCollection SelectAll()
        {
            PURPurchaseHeaderCollection pURPurchaseHeaderCollection = new PURPurchaseHeaderCollection();

            foreach (POS.DataLayer.PURPurchaseHeader _pURPurchaseHeader in POS.DataLayer.PURPurchaseHeaderBase.SelectAll())
            {
                _pURPurchaseHeaderWCF = new PURPurchaseHeader();

                _pURPurchaseHeaderWCF.PurcaseHeaderID     = _pURPurchaseHeader.PurcaseHeaderID;
                _pURPurchaseHeaderWCF.PurchaseDate        = _pURPurchaseHeader.PurchaseDate;
                _pURPurchaseHeaderWCF.PaymentTypeID       = _pURPurchaseHeader.PaymentTypeID;
                _pURPurchaseHeaderWCF.SupplierID          = _pURPurchaseHeader.SupplierID;
                _pURPurchaseHeaderWCF.InvoiceNumber       = _pURPurchaseHeader.InvoiceNumber;
                _pURPurchaseHeaderWCF.CreateDate          = _pURPurchaseHeader.CreateDate;
                _pURPurchaseHeaderWCF.CreatedBy           = _pURPurchaseHeader.CreatedBy;
                _pURPurchaseHeaderWCF.updateDate          = _pURPurchaseHeader.updateDate;
                _pURPurchaseHeaderWCF.UpdatedBy           = _pURPurchaseHeader.UpdatedBy;
                _pURPurchaseHeaderWCF.IsDeleted           = _pURPurchaseHeader.IsDeleted;
                _pURPurchaseHeaderWCF.DeleteDate          = _pURPurchaseHeader.DeleteDate;
                _pURPurchaseHeaderWCF.TotalPrice          = _pURPurchaseHeader.TotalPrice;
                _pURPurchaseHeaderWCF.ServicePrice        = _pURPurchaseHeader.ServicePrice;
                _pURPurchaseHeaderWCF.PaidAmount          = _pURPurchaseHeader.PaidAmount;
                _pURPurchaseHeaderWCF.IsClosed            = _pURPurchaseHeader.IsClosed;
                _pURPurchaseHeaderWCF.IsVoid              = _pURPurchaseHeader.IsVoid;
                _pURPurchaseHeaderWCF.IsPrinted           = _pURPurchaseHeader.IsPrinted;
                _pURPurchaseHeaderWCF.RefuseReasonID      = _pURPurchaseHeader.RefuseReasonID;
                _pURPurchaseHeaderWCF.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
                _pURPurchaseHeaderWCF.TotalDiscountRatio  = _pURPurchaseHeader.TotalDiscountRatio;
                _pURPurchaseHeaderWCF.TaxTypeID           = _pURPurchaseHeader.TaxTypeID;
                _pURPurchaseHeaderWCF.RemainingAmount     = _pURPurchaseHeader.RemainingAmount;
                _pURPurchaseHeaderWCF.LastDayToPay        = _pURPurchaseHeader.LastDayToPay;
                _pURPurchaseHeaderWCF.DeletedBy           = _pURPurchaseHeader.DeletedBy;
                _pURPurchaseHeaderWCF.Notes        = _pURPurchaseHeader.Notes;
                _pURPurchaseHeaderWCF.InventoryID  = _pURPurchaseHeader.InventoryID;
                _pURPurchaseHeaderWCF.InvoiceDate  = _pURPurchaseHeader.InvoiceDate;
                _pURPurchaseHeaderWCF.ChequeNumber = _pURPurchaseHeader.ChequeNumber;

                pURPurchaseHeaderCollection.Add(_pURPurchaseHeaderWCF);
            }
            return(pURPurchaseHeaderCollection);
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method will return a list of objects representing the specified number of entries from the specified record number in the table
        /// using the value of the field specified
        /// </summary>
        ///
        /// <param name="field" type="string">Field of the class PURPurchaseHeader</param>
        /// <param name="fieldValue" type="object">Value for the field specified.</param>
        /// <param name="fieldValue2" type="object">Value for the field specified.</param>
        /// <param name="typeOperation" type="TypeOperation">Operator that is used if fieldValue2=null or fieldValue2="".</param>
        /// <param name="orderByStatement" type="string">The field value to number.</param>
        /// <param name="pageSize" type="int">Number of records returned.</param>
        /// <param name="skipPages" type="int">The number of missing pages.</param>
        ///
        /// <returns>List of object of class PURPurchaseHeader in the form of an object of class PURPurchaseHeaderCollection</returns>
        public PURPurchaseHeaderCollection SelectByFieldPaged(string field, object fieldValue, object fieldValue2, TypeOperation typeOperation, int pageSize, int skipPages, string orderByStatement)
        {
            PURPurchaseHeaderCollection pURPurchaseHeaderCollection = new PURPurchaseHeaderCollection();

            foreach (POS.DataLayer.PURPurchaseHeader _pURPurchaseHeader in POS.DataLayer.PURPurchaseHeaderBase.SelectByFieldPaged(field, fieldValue, fieldValue2, typeOperation, pageSize, skipPages, orderByStatement))
            {
                _pURPurchaseHeaderWCF = new PURPurchaseHeader();

                _pURPurchaseHeaderWCF.PurcaseHeaderID     = _pURPurchaseHeader.PurcaseHeaderID;
                _pURPurchaseHeaderWCF.PurchaseDate        = _pURPurchaseHeader.PurchaseDate;
                _pURPurchaseHeaderWCF.PaymentTypeID       = _pURPurchaseHeader.PaymentTypeID;
                _pURPurchaseHeaderWCF.SupplierID          = _pURPurchaseHeader.SupplierID;
                _pURPurchaseHeaderWCF.InvoiceNumber       = _pURPurchaseHeader.InvoiceNumber;
                _pURPurchaseHeaderWCF.CreateDate          = _pURPurchaseHeader.CreateDate;
                _pURPurchaseHeaderWCF.CreatedBy           = _pURPurchaseHeader.CreatedBy;
                _pURPurchaseHeaderWCF.updateDate          = _pURPurchaseHeader.updateDate;
                _pURPurchaseHeaderWCF.UpdatedBy           = _pURPurchaseHeader.UpdatedBy;
                _pURPurchaseHeaderWCF.IsDeleted           = _pURPurchaseHeader.IsDeleted;
                _pURPurchaseHeaderWCF.DeleteDate          = _pURPurchaseHeader.DeleteDate;
                _pURPurchaseHeaderWCF.TotalPrice          = _pURPurchaseHeader.TotalPrice;
                _pURPurchaseHeaderWCF.ServicePrice        = _pURPurchaseHeader.ServicePrice;
                _pURPurchaseHeaderWCF.PaidAmount          = _pURPurchaseHeader.PaidAmount;
                _pURPurchaseHeaderWCF.IsClosed            = _pURPurchaseHeader.IsClosed;
                _pURPurchaseHeaderWCF.IsVoid              = _pURPurchaseHeader.IsVoid;
                _pURPurchaseHeaderWCF.IsPrinted           = _pURPurchaseHeader.IsPrinted;
                _pURPurchaseHeaderWCF.RefuseReasonID      = _pURPurchaseHeader.RefuseReasonID;
                _pURPurchaseHeaderWCF.TotalDiscountAmount = _pURPurchaseHeader.TotalDiscountAmount;
                _pURPurchaseHeaderWCF.TotalDiscountRatio  = _pURPurchaseHeader.TotalDiscountRatio;
                _pURPurchaseHeaderWCF.TaxTypeID           = _pURPurchaseHeader.TaxTypeID;
                _pURPurchaseHeaderWCF.RemainingAmount     = _pURPurchaseHeader.RemainingAmount;
                _pURPurchaseHeaderWCF.LastDayToPay        = _pURPurchaseHeader.LastDayToPay;
                _pURPurchaseHeaderWCF.DeletedBy           = _pURPurchaseHeader.DeletedBy;
                _pURPurchaseHeaderWCF.Notes        = _pURPurchaseHeader.Notes;
                _pURPurchaseHeaderWCF.InventoryID  = _pURPurchaseHeader.InventoryID;
                _pURPurchaseHeaderWCF.InvoiceDate  = _pURPurchaseHeader.InvoiceDate;
                _pURPurchaseHeaderWCF.ChequeNumber = _pURPurchaseHeader.ChequeNumber;

                pURPurchaseHeaderCollection.Add(_pURPurchaseHeaderWCF);
            }
            return(pURPurchaseHeaderCollection);
        }
Exemplo n.º 5
0
        private void LoadHeaderControls(PURPurchaseHeader Header)
        {
            dtb_Date.Value = Header.InvoiceDate.Value;
            cbx_Inventory.SelectedValue = Header.InventoryID;
            cbx_Supplier.SelectedValue = Header.SupplierID;
            cbx_PaymentType.SelectedValue = Header.PaymentTypeID;
            txt_Total.Text = Header.TotalPrice.ToString();
            txt_DiscountAmount.Text = Header.TotalDiscountAmount.ToString();
            num_Paied.Text = Header.PaidAmount.ToString();
            txt_invoiceNumber.Text = Header.InvoiceNumber;
            num_Remaining.Text = Header.RemainingAmount.ToString();
            if (Header.PaymentTypeID == 2)
            {
                 dtb_LastTimeToPay.Value = Header.LastDayToPay.Value;
            }
            else if (Header.PaymentTypeID == 3)
            {
                txt_chequeNumber.Text = Header.ChequeNumber.ToString ();
            }

            if(Header.TaxTypeID != null)
                cbx_TaxType.SelectedValue = Header.TaxTypeID;
            num_OtherPayments.Text = Header.ServicePrice.ToString();
            if (Header .IsClosed == true)
            {
             pnl_headerData.Enabled = false;
               // pnl_footer.Enabled = false;
            grb_lineData.Enabled = false;
            btn_Save.Enabled = false;
            btn_ClosePrint.Enabled = false;
            btn_Print.Enabled = false;
            cbx_Supplier.Enabled = false;
            dtb_Date.Enabled = false;
            cbx_TaxType.Enabled = false;
            num_OtherPayments.Enabled = false;
            num_Paied.Enabled = false;
            }
               // txt_DiscountRatio.Text = Header.TotalDiscountRatio.ToString();
        }
Exemplo n.º 6
0
        private PURPurchaseHeader CollectHeaderData()
        {
            PURPurchaseHeader _pURPurchaseHeader = new PURPurchaseHeader();
            if (CurrentHeaderID !=0 && CurrentHeaderID !=null)
            {
                _pURPurchaseHeader.PurcaseHeaderID = CurrentHeaderID;
            }
            _pURPurchaseHeader.SupplierID = Convert.ToInt32(cbx_Supplier.SelectedValue);
            _pURPurchaseHeader.InvoiceDate = dtb_Date.Value.Date;
            _pURPurchaseHeader.InvoiceNumber = txt_invoiceNumber.Text;
            _pURPurchaseHeader.PaidAmount = string.IsNullOrEmpty(num_Paied.Text) ? 0 : Convert.ToDecimal(num_Paied.Text);
            _pURPurchaseHeader.RemainingAmount = string.IsNullOrEmpty(num_Remaining.Text) ? 0 : Convert.ToDecimal(num_Remaining.Text);
            _pURPurchaseHeader.PaymentTypeID = Convert.ToInt32(cbx_PaymentType.SelectedValue);
            if ((int)cbx_PaymentType.SelectedValue == 2)
            {
                _pURPurchaseHeader.LastDayToPay = dtb_LastTimeToPay.Value.Date;
                _pURPurchaseHeader.ChequeNumber = null;
                //_pURPurchaseHeader.che
            }
            else if((int)cbx_PaymentType.SelectedValue ==3)
            {
                _pURPurchaseHeader.LastDayToPay = null;
                _pURPurchaseHeader.ChequeNumber =Convert.ToDecimal  ( txt_chequeNumber.Text);

            }
            else
            {
                _pURPurchaseHeader.LastDayToPay = null;
                 _pURPurchaseHeader.ChequeNumber=null;
            }
            _pURPurchaseHeader.ServicePrice = string.IsNullOrEmpty(num_OtherPayments.Text) ? 0 : Convert.ToDecimal(num_OtherPayments.Text);
            _pURPurchaseHeader.TaxTypeID = cbx_TaxType.SelectedIndex == -1 ? null : (int?)(cbx_TaxType.SelectedValue);
            decimal total = Convert.ToDecimal(txt_Total.Text);
               // decimal discountRatio = (Convert.ToDecimal(txt_DiscountRatio.Text.Trim(new char[] { '%' })) / 100);
            _pURPurchaseHeader.TotalDiscountRatio = Convert.ToDouble(txt_DiscountAmount.Text);
            _pURPurchaseHeader.TotalDiscountAmount = 0;
            _pURPurchaseHeader.TotalPrice = Convert.ToDecimal(txt_Total.Text);
            _pURPurchaseHeader.InventoryID = Convert.ToInt32(cbx_Inventory.SelectedValue);
            _pURPurchaseHeader.TotalPrice = total;
            return _pURPurchaseHeader;
        }