Esempio n. 1
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            Int32          RcptId     = Convert.ToInt32(txtRcptNo.Text);
            List <Receipt> lstReceipt = new List <Receipt>();
            int            LocId      = basePage.LoggedInUser.UserLocation.LocationId;
            int            userId     = basePage.LoggedInUser.UserTypeId;

            if (userId == Convert.ToInt32(UserType.Admin))
            {
                LocId      = 0;
                lstReceipt = rcptBal.ReadRcptAll(RcptId, LocId);
            }
            else
            {
                lstReceipt = rcptBal.ReadRcptAll(RcptId, LocId);
            }

            if (lstReceipt.Count == 0)
            {
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('No Receipt Found With This Receipt No.');", true);
                txtRcptNo.Focus();
            }
            else
            {
                Session["lstReceipt"] = lstReceipt;
                Response.Redirect("ReceiptGeneration.aspx?lstReceipt=" + lstReceipt);
            }
        }
Esempio n. 2
0
        protected void gridviewInvoiceList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int    flag         = 0;
            string commndString = e.CommandArgument.ToString();

            string[] str = commndString.Split(',');

            if (e.CommandName == "Print")
            {
                if (rbtnInvoiceLst.SelectedValue == "1")
                {
                    Bill billDOM = new Bill();
                    GenerateInvoiceBAL generateBAL = new GenerateInvoiceBAL();
                    List <Bill>        lstBill     = (List <Bill>)Session["lstBill"];
                    List <BillItem>    lstBillItem = new List <BillItem>();
                    billDOM.BillItemDetails = new List <BillItem>();
                    billDOM.BillConsignment = new Consignment();
                    if (basePage.LoggedInUser.UserLocation != null)
                    {
                        int LocId = basePage.LoggedInUser.UserLocation.LocationId;
                    }
                    int      userId    = basePage.LoggedInUser.UserTypeId;
                    string   strg      = e.CommandArgument.ToString();
                    string[] str1      = strg.Split(',');
                    int      Billid    = Convert.ToInt32(str1[0]);
                    int      versionNo = Convert.ToInt32(str1[1]);
                    Session["version"] = versionNo;
                    if (versionNo == 0)
                    {
                        for (int i = 0; i < lstBill.Count; i++)
                        {
                            if (Billid == lstBill[i].BillId)
                            {
                                Session["flag"] = 1;
                                int billId = lstBill[i].BillId;
                                int CG_Id  = lstBill[i].ConsignmentId;
                                if (userId == Convert.ToInt32(UserType.Admin) || userId == Convert.ToInt32(UserType.SuperAdmin))
                                {
                                    LocId       = 0;
                                    lstBillItem = generateBAL.ReadBillItemRePrintInvoice(billId, null, null);
                                }
                                else
                                {
                                    lstBillItem = generateBAL.ReadBillItemRePrintInvoice(billId, null, null);
                                }

                                for (int j = 0; j < lstBillItem.Count; j++)
                                {
                                    billDOM.BillItemDetail = new BillItem();
                                    billDOM.BillItemDetail.BillItemDescription = lstBillItem[j].BillItemDescription;
                                    billDOM.BillItemDetail.ItemCharge          = lstBillItem[j].ItemCharge;
                                    billDOM.BillItemDetail.ItemQuantity        = lstBillItem[j].ItemQuantity;
                                    billDOM.BillItemDetail.ItemAmount          = lstBillItem[j].ItemCharge * lstBillItem[j].ItemQuantity;
                                    billDOM.BillItemDetails.Add(billDOM.BillItemDetail);
                                }
                                billDOM.BillDate      = lstBill[i].BillDate;
                                billDOM.BillId        = lstBill[i].BillId;
                                billDOM.ServiceCharge = lstBill[i].ServiceCharge;
                                billDOM.ServiceTax    = lstBill[i].ServiceTax;
                                billDOM.TotalAmount   = lstBill[i].TotalAmount;
                                billDOM.Paxs          = lstBill[i].Paxs;
                                billDOM.BillId        = lstBill[i].BillId;

                                Session["billDOM"]       = billDOM;
                                Session["AgentName"]     = lstBill[i].AgentDetails.AgentName;
                                Session["AgentAddress"]  = lstBill[i].AgentDetails.AgentAddress;
                                Session["AgentPhone"]    = lstBill[i].AgentDetails.AgentPhone;
                                Session["ConsignmentId"] = CG_Id;
                            }
                        }
                    }
                    //else
                    //{
                    //    Response.Write("<script LANGUAGE='JavaScript' >alert('Please Select Version For Print Invoice. ')</script>");
                    //}
                    if (Billid > 0)
                    {
                        //Response.Redirect("PreviewPrintInvoice.aspx?CG_Id=" + ConsignmentId);
                        string url     = "PreviewPrintInvoice.aspx?Bill_Id=" + Billid;
                        string fullURL = "window.open('" + url + "', '_blank', 'height=500,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=no' );";
                        ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true);
                    }
                }
            }
            if (rbtnInvoiceLst.SelectedValue == "2")
            {
                if (rbtnInvoiceLst.SelectedValue == "2")
                {
                    int rcptId = Convert.ToInt32(str[0]);

                    ReceiptGenerationBusinessAccess rcptGenerationBal = new ReceiptGenerationBusinessAccess();
                    List <Receipt> lstRcpt = new List <Receipt>();
                    // lstRcpt = rcptGenerationBal.ReadRcptAll(rcptId);
                    if (basePage.LoggedInUser.UserLocation != null)
                    {
                        int LocId = basePage.LoggedInUser.UserLocation.LocationId;
                    }
                    int userId = basePage.LoggedInUser.UserTypeId;
                    if (userId == Convert.ToInt32(UserType.Admin))
                    {
                        LocId   = 0;
                        lstRcpt = rcptGenerationBal.ReadRcptAll(rcptId, LocId);
                    }
                    else
                    {
                        lstRcpt = rcptGenerationBal.ReadRcptAll(rcptId, LocId);
                    }

                    List <ReceiptDetails> lstRcptDetails = new List <ReceiptDetails>();
                    lstRcptDetails = rcptGenerationBal.ReadRcptDetailsByRcptNo(rcptId);
                    if (lstRcpt.Count == 0)
                    {
                        ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('No Receipt Found With This Receipt No !!');", true);
                        txtFromDate.Focus();
                    }
                    else
                    {
                        Session["RcptId"]  = rcptId;
                        Session["lstRcpt"] = lstRcpt;
                        if (lstRcpt[0].RcptType == "  Advance")
                        {
                            Session["NewlstReceipt"] = lstRcpt;
                            Session["agentName"]     = lstRcpt[0].agent.AgentName;
                            if (rcptId > 0)
                            {
                                flag            = 1;
                                Session["Flag"] = flag;
                                string url     = "ReceiptPrint.aspx?receiptAdvance=" + rcptId;
                                string fullUrl = "window.open('" + url + "','_blank','height=500,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=no,addressbars=0,directories=no');";
                                ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullUrl, true);
                            }
                            else
                            {
                                Session["Flag"] = flag;
                            }
                        }
                        else
                        {
                            Session["NewlstRcptDetails"] = lstRcptDetails;
                            if (rcptId > 0)
                            {
                                flag            = 1;
                                Session["Flag"] = flag;
                                string url     = "ReceiptPrint.aspx?RcptId=" + rcptId;
                                string fullUrl = "window.open('" + url + "','_blank','height=500,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=no,addressbars=0,directories=no');";
                                ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullUrl, true);
                            }
                            else
                            {
                                Session["Flag"] = flag;
                            }
                        }
                    }
                }
            }
        }