protected void btnSave_Click(object sender, EventArgs e)
        {
            ICreditNote creditNote = new CreditNoteEntity();

            BuildCreditNoteEntity(creditNote);

            List <ICreditNoteCharge> cnCharges = ViewState["CN_CHARGE"] as List <ICreditNoteCharge>;

            creditNote.CreditNoteCharges = cnCharges;

            long creditNoteId = new CreditNoteBLL().SaveCreditNote(creditNote);

            ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Record saved successfully!');</script>", false);

            if (txtExpImp.Text == "IMPORT")
            {
                Response.Redirect("~/Transaction/BL-Query.aspx?BlNo=" + GeneralFunctions.EncryptQueryString(txtBLRef.Text));
            }
            else
            {
                Response.Redirect("~/Export/Export-bl-query.aspx?BLNumber=" + GeneralFunctions.EncryptQueryString(txtBLRef.Text));
            }

            //Response.Redirect("~/Transaction/BL-Query.aspx?BlNo=" + GeneralFunctions.EncryptQueryString(txtBLRef.Text));
        }
Exemple #2
0
        public CreditNoteViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            this.regionManager   = regionManager;
            this.eventAggregator = eventAggregator;

            CreditNoteEntity = new CreditNoteEntity();
            PQDetailsEntity  = new ObservableCollection <DataGridViewModel>();

            int  minHeight   = 300;
            int  headerRows  = 369;
            var  height      = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 90;
            bool validHeight = int.TryParse(height.ToString(), out minHeight);

            this.PIFormGridHeight = minHeight;
            clickCommand          = new RelayCommand(PrintCommand, CanPrint);

            #region getting Options details
            GetOptionsData();
            #endregion

            AllFieldsEnabled  = true;
            AllFieldsReadonly = false;
            RubberAdjusted    = false;
            LoadSupplierBackground();

            NavigateToClientCommand      = new RelayCommand(NavigatetoSupplier);
            SaveCommand                  = new RelayCommand(UpdateCreditNote, CanSave);
            RefundMoneyToCustomerCommand = new RelayCommand(RefundMoneyToCustomer, CanRefund);
            AdjustCreditNoteCommand      = new RelayCommand(AdjustCreditNote, CanAdjust);
            NavigateToSICommand          = new RelayCommand(NavigateToSI);
            CloseCommand                 = new DelegateCommand(Close);

            if (!String.IsNullOrEmpty(SharedValues.NewClick))
            {
                if (SharedValues.NewClick != "New")
                {
                    MustCompare = false;
                    GetCreditNote(SharedValues.NewClick);
                }
                else if (SharedValues.NewClick == "New")
                {
                    MustCompare = true;
                }
            }
            Mouse.OverrideCursor = null;
        }
Exemple #3
0
        public CreditNoteForm GetDataIntoModel()
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData = purchaseRepository.GetOptionSettings();
            CreditNoteForm PQForm = new CreditNoteForm();

            PQForm.InvoiceDetails = new List <SalesInvoiceDetailEntity>();
            CreditNoteEntity model = new CreditNoteEntity();

            model.CreditNo                = this.CreditNo;
            model.CreditDate              = this.CreditDate;
            model.TotalBeforeTax          = this.TotalBeforeTax;
            model.TotalTax                = this.TotalTax;
            model.TotalAfterTax           = this.TotalAfterTax;
            model.CustomerDebitNoteNo     = this.CustomerDebitNoteNo;
            model.CustomerDebitNoteDate   = DateTime.ParseExact(this.CustomerDebitNoteDateStr, oData.DateFormat, null);
            model.CustomerDebitNoteAmount = this.CustomerDebitNoteAmount;
            model.CustomerID              = this.SelectedCustomerID;

            model.TermsAndConditions = this.TermsAndConditions;

            PQForm.CreditNote = model;

            foreach (var item in PQDetailsEntity)
            {
                SalesInvoiceDetailEntity pqEntity = new SalesInvoiceDetailEntity();
                pqEntity.SINo       = Convert.ToString(item.SelectedPSID);
                pqEntity.PandSCode  = item.PandSCode;
                pqEntity.PandSName  = item.PandSName;
                pqEntity.SIQty      = item.SQQty;
                pqEntity.SIPrice    = item.SQPrice;
                pqEntity.SIDiscount = item.SQDiscount;
                pqEntity.GSTRate    = item.GSTRate;
                pqEntity.SIAmount   = item.SQAmount;
                if (item.SelectedPSID != null && Convert.ToInt32(item.SelectedPSID) > 0)
                {
                    PQForm.InvoiceDetails.Add(pqEntity);
                }
            }
            return(PQForm);
        }
Exemple #4
0
        public static ICreditNote GetfwdCrnHeaderInformation(int InvoiceId)
        {
            string      strExecution = "[fwd].[usp_CN_GetHeaderInfo]";
            ICreditNote creditNote   = null;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@InvoiceId", InvoiceId);

                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    creditNote = new CreditNoteEntity(reader);
                }

                reader.Close();
            }

            return(creditNote);
        }
Exemple #5
0
        public static ICreditNote GetCreditNoteHeaderForView(long CreditNoteId)
        {
            string      strExecution = "usp_CN_GetHeaderForView";
            ICreditNote creditNote   = null;

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddBigIntegerParam("@CreditNoteId", CreditNoteId);

                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    creditNote = new CreditNoteEntity(reader);
                }

                reader.Close();
            }

            return(creditNote);
        }
Exemple #6
0
        public CreditNoteForm GetDataIntoModel()
        {
            CreditNoteForm PQForm = new CreditNoteForm();

            PQForm.InvoiceDetails = new List <SalesInvoiceDetailEntity>();
            CreditNoteEntity model = new CreditNoteEntity();

            model.CreditNo                = this.CreditNo;
            model.CreditDate              = this.CreditDate;
            model.TotalBeforeTax          = this.TotalBeforeTax;
            model.TotalTax                = this.TotalTax;
            model.TotalAfterTax           = this.TotalAfterTax;
            model.CustomerDebitNoteNo     = this.CustomerDebitNoteNo;
            model.CustomerDebitNoteDate   = this.CustomerDebitNoteDate;
            model.CustomerDebitNoteAmount = this.CustomerDebitNoteAmount;
            model.CustomerID              = this.SelectedCustomerID;

            model.TermsAndConditions = this.TermsAndConditions;

            PQForm.CreditNote = model;

            foreach (var item in PQDetailsEntity)
            {
                SalesInvoiceDetailEntity pqEntity = new SalesInvoiceDetailEntity();
                pqEntity.SINo       = Convert.ToString(item.SelectedPSID);
                pqEntity.PandSCode  = item.PandSCode;
                pqEntity.PandSName  = item.PandSName;
                pqEntity.SIQty      = item.SQQty;
                pqEntity.SIPrice    = item.SQPrice;
                pqEntity.SIDiscount = item.SQDiscount;
                pqEntity.GSTRate    = item.GSTRate;
                pqEntity.SIAmount   = item.SQAmount;
                if (item.SelectedPSID != null && Convert.ToInt32(item.SelectedPSID) > 0)
                {
                    PQForm.InvoiceDetails.Add(pqEntity);
                }
            }
            return(PQForm);
        }
Exemple #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ICreditNote creditNote = new CreditNoteEntity();

            BuildCreditNoteEntity(creditNote);

            List <ICreditNoteCharge> cnCharges = ViewState["CN_CHARGE"] as List <ICreditNoteCharge>;

            creditNote.CreditNoteCharges = cnCharges;

            long creditNoteId = new CreditNoteBLL().SavefwdCreditNote(creditNote);

            ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Record saved successfully!');</script>", false);

            string encryptedId = GeneralFunctions.EncryptQueryString(Convert.ToInt32(ViewState["jobId"]).ToString());

            Response.Redirect("~/Forwarding/Transaction/Dashboard.aspx?JobId=" + encryptedId);

            //Response.Redirect("~/Forwarding/Transaction/Dashboard?BlNo=" + GeneralFunctions.EncryptQueryString(txtBLRef.Text));


            //Response.Redirect("~/Transaction/BL-Query.aspx?BlNo=" + GeneralFunctions.EncryptQueryString(txtBLRef.Text));
        }