コード例 #1
0
        public static Receipt CreateAutomaticReceiptInvoiceForSTVTransfer(int POID, int warehouseID, int IDPrinted, int userID)
        {
            BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();
            rctInvoice.AddNew();

            //Enter Invoice Related Information
            //We should Save the STV Number Here
            rctInvoice.POID           = POID;
            rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000");
            rctInvoice.ExchangeRate   = 1;
            rctInvoice.Insurance      = 0;
            rctInvoice.DateOfEntry    = DateTimeHelper.ServerDateTime;
            rctInvoice.IsDeliveryNote = false;
            rctInvoice.Save();
            //Save the receipt
            BLL.Receipt receipt   = new Receipt();
            int         receiptID = receipt.AddNewReceipt(BLL.ReceiptType.CONSTANTS.STANDARD_RECEIPT, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);

            receipt.LoadByPrimaryKey(receiptID);
            return(receipt);
        }
コード例 #2
0
        public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID)
        {
            BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();
            rctInvoice.AddNew();
            var po = new BLL.PO();

            po.LoadByPrimaryKey(POID);
            var activityID = po.StoreID;

            //Enter Invoice Related Information
            //We should Save the STV Number Here
            rctInvoice.POID           = POID;
            rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000");
            rctInvoice.ExchangeRate   = 1;
            rctInvoice.Insurance      = 0;
            rctInvoice.DateOfEntry    = DateTimeHelper.ServerDateTime;
            rctInvoice.SavedByUserID  = userID;
            rctInvoice.ActivityID     = activityID;
            rctInvoice.IsDeliveryNote = false;
            rctInvoice.InvoiceTypeID  = BLL.InvoiceType.InternalSTV;

            rctInvoice.PrintedDate  = DateTimeHelper.ServerDateTime;
            rctInvoice.Rowguid      = Guid.NewGuid();
            rctInvoice.IsVoided     = false;
            rctInvoice.ShippingSite = " ";
            rctInvoice.IsConvertedFromDeliveryNote = false;
            rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV;

            rctInvoice.Save();
            //Save the receipt
            BLL.Receipt receipt   = new Receipt();
            int         receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);

            receipt.LoadByPrimaryKey(receiptID);
            return(receipt);
        }
コード例 #3
0
        private int SaveRelevantReceiptHeaders(int receiptTypeID, int warehouseID)
        {
            int receiptID;
            var receipt = new BLL.Receipt();
            var sup = new BLL.Supplier();

            if (lkReceiptInvoice.EditValue != null && Convert.ToInt32(lkReceiptInvoice.EditValue) != -1)
            {
                receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, CurrentContext.UserId,
                    Convert.ToInt32(lkReceiptInvoice.EditValue), txtEditTransferNo.Text,
                    ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);
                // , txtTransitNo.Text, txtInsuranceNo.Text, txtWayBillNo.Text);
            }
            else
            {
                //PO and ReceiptInvoice created automatically.
                //Needs to be fixed.
                BLL.PO po = new PO();
                BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();

                po.AddNew();
                var serverDateTime = DateTimeHelper.ServerDateTime;
                po.PODate = serverDateTime;
                po.DateOfEntry = serverDateTime;
                po.PurchaseType = POType.INVENTORY;
                po.IsElectronic = false;
                po.POFinalized = false;
                po.Rowguid = Guid.NewGuid();
                po.Identifier = "00000";

                po.PaymentTypeID = BLL.PaymentType.Constants.STV;
                po.TermOfPayement = BLL.PaymentTerm.Internal;
                po.PurchaseOrderStatusID = PurchaseOrderStatus.Processed;

                rctInvoice.AddNew();

                po.StoreID = Convert.ToInt32(lkAccounts.EditValue);
                Activity acc = new Activity();
                acc.LoadByPrimaryKey(po.StoreID);
                po.ModeID = acc.ModeID;

                //po.PONumber = srm ? lkSTVInvoiceNo.EditValue.ToString() : (deliveryNote ? txtRefNo.Text : (beginningBalance ? "BeginningBalance" : String.Empty));

                if (lcSTVNo.Visibility == DevExpress.XtraLayout.Utils.LayoutVisibility.Always)
                {
                    po.PONumber = srm && !chkSRMForOldSystemIssues.Checked
                        ? txtSTVNo.Text
                        : ((deliveryNoteType != DeliveryNoteType.NotSet)
                            ? txtSTVNo.Text
                            : (beginningBalance
                                ? "BeginningBalance"
                                : (srm && chkSRMForOldSystemIssues.Checked
                                    ? txtSTVInvoiceNoOldSystem.Text
                                    : txtRefNo.Text)));
                }
                else
                {
                    po.PONumber = srm && !chkSRMForOldSystemIssues.Checked
                        ? lkSTVInvoiceNo.Text
                        : ((deliveryNoteType != DeliveryNoteType.NotSet)
                            ? txtRefNo.Text
                            : (beginningBalance
                                ? "BeginningBalance"
                                : (srm && chkSRMForOldSystemIssues.Checked
                                    ? txtSTVInvoiceNoOldSystem.Text
                                    : txtRefNo.Text)));
                }

                   //TODO: Ugly hack, supplier. To be fixed.
                    if (srm)
                    {
                        po.SupplierID = BLL.Supplier.CONSTANTS.RETURNED_FROM_FACILITY;

                        //Let's put Finance Required stuff here.
                        po.Insurance = 0;
                        po.ExhangeRate = 1;
                        rctInvoice.ExchangeRate = 1;
                        rctInvoice.Insurance = 0;

                        rctInvoice.InvoiceTypeID = ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE;

                        if (chkSRMForOldSystemIssues.Checked)
                        {
                            if (lkForFacility.EditValue == null)
                                throw new Exception("Facility not chosen!");
                            po.RefNo = lkForFacility.EditValue.ToString();
                        }
                    }

                po.SavedbyUserID = CurrentContext.LoggedInUser.ID;
                po.Save();

                rctInvoice.POID = po.ID;
                if (lcSTVNo.Visibility == DevExpress.XtraLayout.Utils.LayoutVisibility.Always)
                {
                    rctInvoice.STVOrInvoiceNo = srm && !chkSRMForOldSystemIssues.Checked
                        ? txtSTVNo.Text
                        : ((deliveryNoteType != DeliveryNoteType.NotSet)
                            ? txtSTVNo.Text
                            : (beginningBalance
                                ? "BeginningBalance"
                                : (srm && chkSRMForOldSystemIssues.Checked
                                    ? txtSTVInvoiceNoOldSystem.Text
                                    : txtSTVNo.Text)));
                }
                else
                {
                    rctInvoice.STVOrInvoiceNo = srm && !chkSRMForOldSystemIssues.Checked
                        ? lkSTVInvoiceNo.Text
                        : ((deliveryNoteType != DeliveryNoteType.NotSet)
                            ? txtRefNo.Text
                            : (beginningBalance
                                ? "BeginningBalance"
                                : (srm && chkSRMForOldSystemIssues.Checked
                                    ? txtSTVInvoiceNoOldSystem.Text
                                    : txtRefNo.Text)));
                }
                rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime;
                rctInvoice.ActivityID = po.StoreID;
                rctInvoice.SavedByUserID = CurrentContext.LoggedInUser.ID;
                rctInvoice.IsDeliveryNote = false;

                rctInvoice.Rowguid = Guid.NewGuid();
                rctInvoice.PrintedDate = po.DateOfEntry;
                rctInvoice.IsVoided = false;
                rctInvoice.ShippingSite = " ";
                rctInvoice.IsConvertedFromDeliveryNote = false;
                rctInvoice.IsDeliveryNote = false;
                rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.SRM;

                rctInvoice.Save();

                receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, CurrentContext.UserId, rctInvoice.ID,
                    txtTransitTransferVoucherNo.Text, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);

                //receiptID = receipt.AddNewReceipt(receiptTypeID, NewMainWindow.UserId);
            }
            return receiptID;
        }
コード例 #4
0
        public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID)
        {
            BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();
            rctInvoice.AddNew();
            var po = new BLL.PO();
            po.LoadByPrimaryKey(POID);
            var activityID = po.StoreID;

            //Enter Invoice Related Information
            //We should Save the STV Number Here
            rctInvoice.POID = POID;
            rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000");
            rctInvoice.ExchangeRate = 1;
            rctInvoice.Insurance = 0;
            rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime;
            rctInvoice.SavedByUserID = userID;
            rctInvoice.ActivityID = activityID;
            rctInvoice.IsDeliveryNote = false;
            rctInvoice.InvoiceTypeID = BLL.InvoiceType.InternalSTV;

            rctInvoice.PrintedDate = DateTimeHelper.ServerDateTime;
            rctInvoice.Rowguid = Guid.NewGuid();
            rctInvoice.IsVoided = false;
            rctInvoice.ShippingSite = " ";
            rctInvoice.IsConvertedFromDeliveryNote = false;
            rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV;

            rctInvoice.Save();
            //Save the receipt
            BLL.Receipt receipt = new Receipt();
            int receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);
            receipt.LoadByPrimaryKey(receiptID);
            return receipt;
        }
コード例 #5
0
        public static Receipt CreateAutomaticReceiptInvoiceForSTVTransfer(int POID, int warehouseID, int IDPrinted, int userID)
        {
            BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice();
            rctInvoice.AddNew();

            //Enter Invoice Related Information
            //We should Save the STV Number Here
            rctInvoice.POID = POID;
            rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000");
            rctInvoice.ExchangeRate = 1;
            rctInvoice.Insurance = 0;
            rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime;
            rctInvoice.IsDeliveryNote = false;
            rctInvoice.Save();
            //Save the receipt
            BLL.Receipt receipt = new Receipt();
            int receiptID = receipt.AddNewReceipt(BLL.ReceiptType.CONSTANTS.STANDARD_RECEIPT, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED);
            receipt.LoadByPrimaryKey(receiptID);
            return receipt;
        }