Beispiel #1
0
        public void TextInvoiceNo_TextChanged(object sender, EventArgs e)
        {
            string InvoiceNo = TextInvoiceNo.Text;

            if (InvoiceNo != null)
            {
                alert_box.Visible = false;

                OracleConnection conn = new OracleConnection(strConnString);
                conn.Open();
                OracleCommand cmd = new OracleCommand();
                cmd.Connection  = conn;
                cmd.CommandText = "select INVOICE_NO from PF_SALES_JW where INVOICE_NO = '" + InvoiceNo + "'";
                cmd.CommandType = CommandType.Text;

                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.HasRows)
                {
                    CheckInvoiceNo.Text      = "<label class='control-label'><i class='fa fa-times-circle-o'></i> Invoice Number is not available</label>";
                    CheckInvoiceNo.ForeColor = System.Drawing.Color.Red;
                    TextInvoiceNo.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "false");
                    BtnAdd.Attributes.Add("class", "btn btn-primary disabled");
                    DropDownCustomerID.Text = "0";
                    TextItemWeight.Text     = "";
                    DropDownCustomerID.Attributes.Add("disabled", "disabled");
                    TextItemWeight.Attributes.Add("disabled", "disabled");
                }
                else
                {
                    CheckInvoiceNo.Text      = "<label class='control-label'><i class='fa fa fa-check'></i> Invoice Number is available</label>";
                    CheckInvoiceNo.ForeColor = System.Drawing.Color.Green;
                    DropDownCustomerID.Focus();
                    BtnAdd.Attributes.Add("aria-disabled", "true");
                    BtnAdd.Attributes.Add("class", "btn btn-primary active");
                    DropDownCustomerID.Attributes.Remove("disabled");
                    TextItemWeight.Attributes.Remove("disabled");
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["USER_NAME"] != null)
            {
                string           requestedFile = Path.GetFileName(Request.Path);
                OracleConnection conn          = new OracleConnection(strConnString);
                conn.Open();
                string makeSQL = " SELECT  NUPP.IS_PAGE_ACTIVE, NUPP.IS_ADD_ACTIVE, NUPP.IS_EDIT_ACTIVE, NUPP.IS_DELETE_ACTIVE, NUPP.IS_VIEW_ACTIVE, NUPP.IS_REPORT_ACTIVE FROM NRC_USER_PAGE_PERMISSION NUPP LEFT JOIN NRC_USER_PAGES NUP ON NUP.USER_PAGE_ID = NUPP.USER_PAGE_ID  WHERE NUPP.USER_ID = '" + Session["USER_ID"] + "' AND NUP.IS_ACTIVE = 'Enable' AND NUP.PAGE_URL = '" + requestedFile + "' ";
                cmdl    = new OracleCommand(makeSQL);
                oradata = new OracleDataAdapter(cmdl.CommandText, conn);
                dt      = new DataTable();
                oradata.Fill(dt);
                RowCount = dt.Rows.Count;

                for (int i = 0; i < RowCount; i++)
                {
                    IS_PAGE_ACTIVE   = dt.Rows[i]["IS_PAGE_ACTIVE"].ToString();
                    IS_ADD_ACTIVE    = dt.Rows[i]["IS_ADD_ACTIVE"].ToString();
                    IS_EDIT_ACTIVE   = dt.Rows[i]["IS_EDIT_ACTIVE"].ToString();
                    IS_DELETE_ACTIVE = dt.Rows[i]["IS_DELETE_ACTIVE"].ToString();
                    IS_VIEW_ACTIVE   = dt.Rows[i]["IS_VIEW_ACTIVE"].ToString();
                    IS_REPORT_ACTIVE = dt.Rows[i]["IS_REPORT_ACTIVE"].ToString();
                }

                if (IS_PAGE_ACTIVE == "Enable")
                {
                    if (!IsPostBack)
                    {
                        DataTable dtCustomerID    = new DataTable();
                        DataSet   ds              = new DataSet();
                        string    makeCustomerSQL = " SELECT PP.PARTY_ID, PP.PARTY_NAME FROM PF_PURCHASE_JW PPJ LEFT JOIN PF_PARTY PP ON PP.PARTY_ID =  PPJ.PARTY_ID WHERE PP.IS_ACTIVE = 'Enable' GROUP BY  PP.PARTY_ID, PP.PARTY_NAME ORDER BY PP.PARTY_NAME ASC";
                        ds           = ExecuteBySqlStringEmpType(makeCustomerSQL);
                        dtCustomerID = (DataTable)ds.Tables[0];
                        DropDownCustomerID.DataSource     = dtCustomerID;
                        DropDownCustomerID.DataValueField = "PARTY_ID";
                        DropDownCustomerID.DataTextField  = "PARTY_NAME";
                        DropDownCustomerID.DataBind();
                        DropDownCustomerID.Items.Insert(0, new ListItem("Select Customer", "0"));

                        DataTable dtItemID            = new DataTable();
                        DataSet   dsi                 = new DataSet();
                        string    makeDropDownItemSQL = " SELECT * FROM PF_ITEM WHERE IS_ACTIVE = 'Enable' ORDER BY ITEM_ID ASC";
                        dsi      = ExecuteBySqlStringEmpType(makeDropDownItemSQL);
                        dtItemID = (DataTable)dsi.Tables[0];
                        DropDownItemID.DataSource     = dtItemID;
                        DropDownItemID.DataValueField = "ITEM_ID";
                        DropDownItemID.DataTextField  = "ITEM_NAME";
                        DropDownItemID.DataBind();
                        DropDownItemID.Items.Insert(0, new ListItem("Select  Item", "0"));

                        DropDownItemID1.DataSource     = dtItemID;
                        DropDownItemID1.DataValueField = "ITEM_ID";
                        DropDownItemID1.DataTextField  = "ITEM_NAME";
                        DropDownItemID1.DataBind();
                        DropDownItemID1.Items.Insert(0, new ListItem("All Item", "0"));

                        DataTable dtSubItemID            = new DataTable();
                        DataSet   dss                    = new DataSet();
                        string    makeDropDownSubItemSQL = " SELECT * FROM PF_SUB_ITEM WHERE IS_ACTIVE = 'Enable' ORDER BY SUB_ITEM_ID ASC";
                        dss         = ExecuteBySqlStringEmpType(makeDropDownSubItemSQL);
                        dtSubItemID = (DataTable)dss.Tables[0];
                        DropDownSubItemID.DataSource     = dtSubItemID;
                        DropDownSubItemID.DataValueField = "SUB_ITEM_ID";
                        DropDownSubItemID.DataTextField  = "SUB_ITEM_NAME";
                        DropDownSubItemID.DataBind();
                        DropDownSubItemID.Items.Insert(0, new ListItem("Select Sub Item", "0"));

                        DataTable dtPgeID            = new DataTable();
                        DataSet   dsp                = new DataSet();
                        string    makeDropDownPgeSQL = " SELECT * FROM NRC_VAT WHERE IS_ACTIVE = 'Enable' ORDER BY VAT_ID ASC";
                        dsp     = ExecuteBySqlStringEmpType(makeDropDownPgeSQL);
                        dtPgeID = (DataTable)dsp.Tables[0];
                        DropDownVatID.DataSource     = dtPgeID;
                        DropDownVatID.DataValueField = "VAT_ID";
                        DropDownVatID.DataTextField  = "VAT_PERCENT";
                        DropDownVatID.DataBind();
                        //   DropDownVatID.Items.Insert(0, new ListItem("Select Garbage Est. of Prod.", "0"));

                        DropDownCustomerID.Attributes.Add("disabled", "disabled");
                        //  TextItemWeight.Attributes.Add("disabled", "disabled");

                        TextInvoiceNo.Focus();

                        Display();
                        alert_box.Visible = false;
                    }
                    IsLoad = false;
                }
                else
                {
                    Response.Redirect("~/PagePermissionError.aspx");
                }
            }
            else
            {
                Response.Redirect("~/Default.aspx");
            }
        }
Beispiel #3
0
        public void BtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (IS_ADD_ACTIVE == "Enable")
                {
                    OracleConnection conn = new OracleConnection(strConnString);
                    conn.Open();

                    int    userID     = Convert.ToInt32(Session["USER_ID"]);
                    string InvoiceNo  = TextInvoiceNo.Text;
                    int    CustomerID = Convert.ToInt32(DropDownCustomerID.Text);
                    int    ItemID     = Convert.ToInt32(DropDownItemID.Text);
                    double ItemRate   = Convert.ToDouble(TextItemRate.Text);
                    double ItemWeight = Convert.ToDouble(TextItemWeight.Text);
                    double ItemAmount = ItemRate * ItemWeight;
                    int    VatID      = Convert.ToInt32(DropDownVatID.Text);
                    double VatPercent = Convert.ToDouble(DropDownVatID.SelectedItem.Text);
                    double VatAmount  = (ItemAmount * VatPercent) / 100;

                    int    SubItemID   = Convert.ToInt32(DropDownSubItemID.Text);
                    string ItemName    = DropDownItemID.SelectedItem.Text;
                    string SubItemName = "";
                    if (SubItemID == 0)
                    {
                        SubItemID = 0; SubItemName = "";
                    }
                    else
                    {
                        SubItemID = Convert.ToInt32(DropDownSubItemID.Text); SubItemName = DropDownSubItemID.SelectedItem.Text;
                    }
                    string   Remarks            = TextRemarks.Text;
                    string   ISActive           = CheckIsActive.Checked ? "Enable" : "Disable";
                    string   MakeEntryDate      = EntryDate.Text;
                    string[] MakeEntryDateSplit = MakeEntryDate.Split('-');

                    String   EntryDateTemp = MakeEntryDateSplit[0].Replace("/", "-");
                    DateTime EntryDateNewD = DateTime.ParseExact(EntryDateTemp, "dd-MM-yyyy", CultureInfo.InvariantCulture);
                    string   EntryDateNew  = EntryDateNewD.ToString("dd-MM-yyyy");

                    string c_date = System.DateTime.Now.ToString("dd-MM-yyyy h:mm:ss tt");

                    // insert sales data
                    string get_user_production_id = "select PF_SALES_JWID_SEQ.nextval from dual";
                    cmdu = new OracleCommand(get_user_production_id, conn);
                    int    newSalesID        = Int16.Parse(cmdu.ExecuteScalar().ToString());
                    string insert_production = "insert into  PF_SALES_JW (SALES_JW_ID, INVOICE_NO, PARTY_ID, ITEM_ID, SUB_ITEM_ID, ITEM_WEIGHT, ITEM_RATE, ITEM_AMOUNT, VAT_ID, VAT_PERCENT, VAT_AMOUNT, REMARKS, ENTRY_DATE, CREATE_DATE, C_USER_ID, IS_ACTIVE, IS_OBJ_QUERY, DIVISION_ID) values ( :NoSalesID, :NoInvoiceNo, :NoCustomerID, :NoItemID, :NoSubItemID,  :TextItemWeight, :TextItemRate, :TextItemAmount, :NoVatID, :NoVatPercent, :NoVatAmount, :TextRemarks, TO_DATE(:EntryDate, 'DD/MM/YYYY'), TO_DATE(:c_date, 'DD-MM-YYYY HH:MI:SS AM'), :NoCuserID, :TextIsActive, :TextIObjQuery, 3)";
                    cmdi = new OracleCommand(insert_production, conn);

                    OracleParameter[] objPrm = new OracleParameter[17];
                    objPrm[0]  = cmdi.Parameters.Add("NoSalesID", newSalesID);
                    objPrm[1]  = cmdi.Parameters.Add("NoInvoiceNo", InvoiceNo);
                    objPrm[2]  = cmdi.Parameters.Add("NoCustomerID", CustomerID);
                    objPrm[3]  = cmdi.Parameters.Add("NoItemID", ItemID);
                    objPrm[4]  = cmdi.Parameters.Add("NoSubItemID", SubItemID);
                    objPrm[5]  = cmdi.Parameters.Add("TextItemWeight", ItemWeight);
                    objPrm[6]  = cmdi.Parameters.Add("TextItemRate", ItemRate);
                    objPrm[7]  = cmdi.Parameters.Add("TextItemAmount", ItemAmount);
                    objPrm[8]  = cmdi.Parameters.Add("NoVatID", VatID);
                    objPrm[9]  = cmdi.Parameters.Add("NoVatPercent", VatPercent);
                    objPrm[10] = cmdi.Parameters.Add("NoVatAmount", VatAmount);
                    objPrm[11] = cmdi.Parameters.Add("TextRemarks", Remarks);
                    objPrm[12] = cmdi.Parameters.Add("EntryDate", EntryDateNew);
                    objPrm[13] = cmdi.Parameters.Add("c_date", c_date);
                    objPrm[14] = cmdi.Parameters.Add("NoCuserID", userID);
                    objPrm[15] = cmdi.Parameters.Add("TextIsActive", ISActive);
                    objPrm[16] = cmdi.Parameters.Add("TextIObjQuery", "No");

                    cmdi.ExecuteNonQuery();
                    cmdi.Parameters.Clear();
                    cmdi.Dispose();

                    conn.Close();

                    alert_box.Visible = true;
                    alert_box.Controls.Add(new LiteralControl("Insert New Job Work (Sales) Successfully"));
                    alert_box.Attributes.Add("class", "alert alert-success alert-dismissible");

                    clearText();
                    TextInvoiceNo.Focus();
                    Display();
                }
                else
                {
                    Response.Redirect("~/PagePermissionError.aspx");
                }
            }
            catch
            {
                Response.Redirect("~/ParameterError.aspx");
            }
        }