コード例 #1
0
        protected void populateRFQList()
        {
            String RespEntityId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString();

            ActionLibrary.SalesActions._dispPotentials dP = new SalesActions._dispPotentials();

            ArrayList potList = dP.getAllPotentials(RespEntityId, User.Identity.Name);

            for (int i = 0; i < potList.Count; i++)
            {
                PotentialRecords potRec = (PotentialRecords)potList[i];

                if (potRec.getPotStat().Equals(BackEndObjects.RFQShortlisted.POTENTIAL_ACTIVE_STAT_CLOSED_WON))
                {
                    ListItem ltRFQ = new ListItem();
                    ltRFQ.Text  = potRec.getRFQName();
                    ltRFQ.Value = potRec.getRFQId();

                    BackEndObjects.Invoice invObj = BackEndObjects.Invoice.getInvoicebyRfIdDB(potRec.getRFQId());
                    if (invObj != null && invObj.getInvoiceId() != null && !invObj.getInvoiceId().Equals(""))
                    {
                        ltRFQ.Attributes.Add("style", "background-color:Green;");
                    }

                    DropDownList1.Items.Add(ltRFQ);
                }
            }
        }
コード例 #2
0
        protected void Button_Create_Inv_Click(object sender, EventArgs e)
        {
            BackEndObjects.Invoice invObj = new BackEndObjects.Invoice();

            invObj.setInvoiceId(new Id().getNewId(BackEndObjects.Id.ID_TYPE_INV_ID_STRING));
            invObj.setRespEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            invObj.setInvComments(TextBox_TnC.Text);
            invObj.setInvoiceDate(TextBox_Inv_Date.Text);
            invObj.setDeliveryStatus(BackEndObjects.DeliveryStat.DELIV_STAT_UNDELIVERED);
            invObj.setInvoiceType(BackEndObjects.InvoiceType.INVOICE_TYPE_TAX_INVOICE);
            invObj.setPaymentStatus(BackEndObjects.PaymentStat.PAYMENT_STAT_INCOMPLETE);
            invObj.setPolicyNo(TextBox_Policy_No.Text);
            invObj.setRFQId(Request.QueryString.GetValues("rfId")[0]);
            invObj.setShipVia(TextBox_Ship_Via.Text);
            invObj.setTaxableAmnt(float.Parse(TextBox_Taxable_Amount.Text));
            invObj.setTotalAmount(float.Parse(Label_Total_Amount_Value.Text));
            //For invoice in auto-created mode, the invoice no and invoice id will be same
            invObj.setInvoiceNo(invObj.getInvoiceId());
            invObj.setCreationMode(BackEndObjects.Invoice.INVOICE_CREATION_MODE_AUTO);

            ArrayList invTaxComp = new ArrayList();

            foreach (GridViewRow gVR in GridView_Inv_Tax_Comp.Rows)
            {
                BackEndObjects.InvoiceComponents invCompObj = new BackEndObjects.InvoiceComponents();

                invCompObj.setInvoice_Id(invObj.getInvoiceId());
                invCompObj.setSection_type(BackEndObjects.InvoiceComponents.INVOICE_SECTION_TYPE_TAX);
                invCompObj.setSection_type_name(((Label)gVR.Cells[0].FindControl("Label_Name")).Text);
                invCompObj.setSection_value(((TextBox)gVR.Cells[0].FindControl("TextBox_Value")).Text);

                invTaxComp.Add(invCompObj);
            }

            try
            {
                BackEndObjects.Invoice.insertInvoiceDB(invObj);
                BackEndObjects.InvoiceComponents.insertInvoiceComponentListDB(invTaxComp);
                Label_INV_Creation_Stat.Visible   = true;
                Label_INV_Creation_Stat.ForeColor = System.Drawing.Color.Green;
                Label_INV_Creation_Stat.Text      = "Invoice Created Successfully";
                Label_INV_No.Text         = invObj.getInvoiceId();
                Button_Create_Inv.Enabled = false;
            }
            catch (Exception ex)
            {
                Label_INV_Creation_Stat.Visible   = true;
                Label_INV_Creation_Stat.ForeColor = System.Drawing.Color.Red;
                Label_INV_Creation_Stat.Text      = "Invoice Creation Failed";
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                String rfId       = Request.QueryString.GetValues("rfId")[0];
                String context    = Request.QueryString.GetValues("context")[0];
                String poId       = Request.QueryString.GetValues("poId")[0];
                String otherEntId = "";
                //This flag determines whether or no any tax component is changed in this screen
                Label_Inv_Tax_Comp_Changed.Text = "N";

                String invId = Request.QueryString.GetValues("invId")[0];
                BackEndObjects.Invoice invObj = new BackEndObjects.Invoice();

                if (invId != null && !invId.Equals(""))
                {
                    invObj = BackEndObjects.Invoice.getInvoicebyIdDB(invId);
                    loadAlreadyCreatedInvData(invObj);
                }
                else
                {
                    //If invoice data does not exist then forward to create invoice screen
                    String forwardString = "/Pages/createInvoice.aspx";
                    forwardString += "?rfId=" + rfId;
                    if (poId == null || poId.Equals(""))
                    {
                        forwardString += "&emptySO=" + "true";
                    }

                    Response.Redirect(forwardString);
                    //Server.Transfer(forwardString);
                    //ScriptManager.RegisterStartupScript(this, typeof(string), "createInv", "window.open('" + forwardString + "',null,'resizeable=yes,scrollbars=yes,addressbar=no,toolbar=no,width=900,Height=900');", true);
                }
                //   Button_Update_Inv.Visible = false;


                RFQShortlisted rfqDealObj = BackEndObjects.RFQShortlisted.getRFQShortlistedEntryforFinalizedVendor(rfId);

                if (context.Equals("client") || context.Equals("clientInvoiceGrid"))
                {
                    otherEntId = rfqDealObj.getRespEntityId();
                    //If control is in client context, then the invoice is already created and the response entity details are available
                    if (otherEntId == null || otherEntId.Equals(""))
                    {
                        otherEntId = invObj.getRespEntityId();
                    }
                }
                else
                {
                    bool approvalContext = false;
                    if (Request.QueryString.GetValues("approvalContext") != null)
                    {
                        approvalContext = Request.QueryString.GetValues("approvalContext")[0].Equals("Y") ? true : false;
                    }

                    if (approvalContext)
                    {
                        Button_Create_Inv.Enabled         = false;
                        Button_Update_Inv.Enabled         = false;
                        Label_INV_Creation_Stat.Visible   = true;
                        Label_INV_Creation_Stat.Text      = "To edit anything for this invoice, please check the invoice from Sales->Invoice screen.";
                        Label_INV_Creation_Stat.ForeColor = System.Drawing.Color.Red;
                    }
                    else
                    {
                        Dictionary <String, bool> accessList = (Dictionary <String, bool>)Session[SessionFactory.ACCESSLIST_FOR_USER];
                        if (!accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_EDIT_INVOICE_SALES] &&
                            !accessList[BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_OWNER_ACCESS])
                        {
                            Label_INV_Creation_Stat.Visible   = true;
                            Label_INV_Creation_Stat.Text      = "You don't have edit access to invoice record";
                            Label_INV_Creation_Stat.ForeColor = System.Drawing.Color.Red;
                            Button_Create_Inv.Enabled         = false;
                            Button_Update_Inv.Enabled         = false;
                        }
                    }
                    otherEntId = RFQDetails.getRFQDetailsbyIdDB(rfId).getEntityId();
                }

                loadClientAndVendorDetails(rfId, otherEntId);
                loadProductGrid(poId);
                populateLogo(otherEntId, context);
                loadInvTaxCompGrid(invId);
                loadTnC(invObj);
                updateTotalINVAmount();

                if (context.Equals("client") || context.Equals("clientInvoiceGrid"))
                {
                    disableControlsForClient();
                }
            }
        }
コード例 #4
0
        protected void fillOutoingInvGrid(ArrayList invList)
        {
            String[] contactEntId = Request.QueryString.GetValues("contactId");

            if (invList == null || invList.Count == 0)
            {
                invList = BackEndObjects.Invoice.getAllInvoicesbyRespEntId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString());
            }

            DataTable dt = new DataTable();

            dt.Columns.Add("rfqId");
            dt.Columns.Add("InvId");
            dt.Columns.Add("InvNo");
            dt.Columns.Add("totalAmnt");
            dt.Columns.Add("InvDate");
            dt.Columns.Add("pmntStat");
            dt.Columns.Add("totalPending");

            DateUtility dU = new DateUtility();

            int counter = 0;

            for (int i = 0; i < invList.Count; i++)
            {
                BackEndObjects.Invoice invObj = (BackEndObjects.Invoice)invList[i];

                //Filter out invoices whicha re meant for this contact only
                BackEndObjects.RFQDetails rfqObj = BackEndObjects.RFQDetails.getRFQDetailsbyIdDB(invObj.getRFQId());
                if (rfqObj != null && rfqObj.getEntityId() != null && rfqObj.getEntityId().Equals(contactEntId[0]))
                {
                    float totalPendingAmnt = 0;
                    float totalClearedAmnt = 0;

                    Dictionary <String, Payment> pmntDict = BackEndObjects.Payment.getPaymentDetailsforInvoiceDB(invObj.getInvoiceId());

                    foreach (KeyValuePair <String, Payment> kvp in pmntDict)
                    {
                        BackEndObjects.Payment pmntObj = kvp.Value;

                        totalClearedAmnt += pmntObj.getClearingStat().Equals(BackEndObjects.Payment.PAYMENT_CLEARING_STAT_CLEAR) ?
                                            pmntObj.getAmount() : 0;
                    }

                    totalPendingAmnt = invObj.getTotalAmount() - totalClearedAmnt;

                    dt.Rows.Add();
                    dt.Rows[counter]["rfqId"]        = invObj.getRFQId();
                    dt.Rows[counter]["InvId"]        = invObj.getInvoiceId();
                    dt.Rows[counter]["InvNo"]        = invObj.getInvoiceNo() != null && !invObj.getInvoiceNo().Equals("") ? invObj.getInvoiceNo() : invObj.getInvoiceId();
                    dt.Rows[counter]["totalAmnt"]    = invObj.getTotalAmount();
                    dt.Rows[counter]["InvDate"]      = dU.getConvertedDate(invObj.getInvoiceDate().Substring(0, invObj.getInvoiceDate().IndexOf(" ")));
                    dt.Rows[counter]["pmntStat"]     = invObj.getPaymentStatus();
                    dt.Rows[counter]["totalPending"] = totalPendingAmnt;

                    counter++;
                }
            }

            GridView_Outgoing_Invoices.Visible    = true;
            GridView_Outgoing_Invoices.DataSource = dt;
            GridView_Outgoing_Invoices.DataBind();
            GridView_Outgoing_Invoices.SelectedIndex = -1;
            Session[SessionFactory.ALL_CONTACT_ALL_DEAL_OUTGOING_INV_GRID]      = dt;
            Session[SessionFactory.ALL_CONTACT_ALL_DEAL_OUTGOING_INV_ARRAYLIST] = invList;
        }