Beispiel #1
0
        private void btn_Cancel_Click(object sender, ItemClickEventArgs e)
        {
            int  nRet_Val = 0;
            INPR clsINPR  = new INPR();

            if (lblInv_SqNo.Text == "")
            {
                clsHomeScreen.Display_Message("Please select a record for Cancel...", false);
                return;
            }

            //---user authorizations
            //if (!(pUser_Auth(pcU_M_09_C03_D, 1, 1)))
            //{
            //    return;
            //}

            //---alert
            if (MessageBox.Show(cnMsg_Before_Cancel, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            //strAuth_D = mSys_IN.pcU_M_01_C09_C;


            int nDept_ID       = -1;
            int nDept_ID_Store = -1;
            int nBranch_ID     = -1;

            double nQty_FOC      = 0;
            double nQty_Accepted = 0;
            double nQty_Item     = nQty_FOC + nQty_Accepted;



            nRet_Val = clsINPR.Save_Authorize(Convert.ToInt32(lblInv_SqNo.Text), txtTr_No.Text.Trim(), Convert.ToDateTime(dtpTr_Date.EditValue), mSys_System.pFYSDate,
                                              mSys_System.pBranch_ID, nDept_ID, nDept_ID_Store, nQty_Item, txtRef1.Text, txtRef1.Text,
                                              mSys_System.pTrLevel_Cancelled, mSys_System.pComp_ID, mSys_System.pUserName, mSys_System.pUser_ID, strAuth_D, mSys_System.pFY_ID);

            if (clsINPR.strErrorCode.Trim() != "")
            {
                clsHomeScreen.Display_Message(cnMsg_ErrSaveUpdate + clsINPR.strErrorCode + "....................", false);
                return;
            }
            if (nRet_Val == 1)
            {
                clsHomeScreen.Display_Message(cnMsg_SaveUpdateComplete, false);
                lblTrLevel.Text = mSys_System.pTrLevel_Cancelled.ToString();
                Set_TrLevel();
                //Fill_Grid();
                //  //Fill_Grid();
                return;
            }
            else if (nRet_Val == -1)
            {
                clsHomeScreen.Display_Message(clsINPR.strErr_Msg, false);
                return;
            }
        }
Beispiel #2
0
        //private void btn_Print_Click(object sender, EventArgs e)
        //{
        //    BMS.RptViewer frmRptViewer = new BMS.RptViewer();
        //    ParameterField rptParamField = new ParameterField();
        //    ParameterFields rptParamFields = new ParameterFields();
        //    ParameterDiscreteEditValue rptParamDiscreteEditValue = new ParameterDiscreteEditValue();
        //    ReportDocument rptDocument = new ReportDocument();

        //    string strRptNo = "";
        //    string strRpt = "";

        //    rptParamField = new ParameterField();
        //    rptParamDiscreteEditValue = new ParameterDiscreteEditValue();
        //    rptParamField.Name = "@nComp_ID";
        //    rptParamDiscreteEditValue.EditValue = mSys_System.pComp_ID.ToString();
        //    rptParamField.CurrentEditValues.Add(rptParamDiscreteEditValue);
        //    rptParamFields.Add(rptParamField);

        //    rptParamField = new ParameterField();
        //    rptParamDiscreteEditValue = new ParameterDiscreteEditValue();
        //    rptParamField.Name = "@nInv_SqNo";
        //    rptParamDiscreteEditValue.EditValue = lblInv_SqNo.Text;
        //    rptParamField.CurrentEditValues.Add(rptParamDiscreteEditValue);
        //    rptParamFields.Add(rptParamField);

        //    try
        //    {
        //        strRpt = Application.StartupPath;
        //        strRpt = strRpt.Substring(0, strRpt.Length - 3) + "Reports\\rptIN0021.rpt";

        //        rptDocument.Load(strRpt);
        //        Set_ReportConnection(rptDocument);
        //    }
        //    catch (Exception ex)
        //    {
        //        clsHomeScreen.Display_Message(ex.Message, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        //    }
        //    //---Passing Report Formula's
        //    FormulaFieldDefinitions formulaList;
        //    formulaList = rptDocument.DataDefinition.FormulaFields;
        //    formulaList["CN"].Text = "'" + mSys_System.pCN.ToString().ToUpper() + "'";
        //    formulaList["Branch_Name"].Text = "'" + mSys_System.pBranch_SName.ToUpper() + "'";
        //    formulaList["Criteria1"].Text = "'Purchase Order'";
        //    formulaList["RPT"].Text = "'" + strRptNo + "'";
        //    formulaList["UserName"].Text = "'" + mSys_System.pUser_FullName + "'";

        //    //---Passing Selection formula
        //    rptDocument.DataDefinition.RecordSelectionFormula = "";

        //    //---Setting Report to view
        //    frmRptViewer.crv.ParameterFieldInfo = rptParamFields;
        //    frmRptViewer.crv.ReportSource = rptDocument;
        //    frmRptViewer.Show();

        //}
        //private void Set_ReportConnection(ReportDocument rptDocument)
        //{
        //    TableLogOnInfo crLogonInfo;

        //    database1 clsDatabase1 = new database1();
        //    crLogonInfo = rptDocument.Database.Tables[0].LogOnInfo;
        //    crLogonInfo.ConnectionInfo.ServerName = database1.strServerName;
        //    crLogonInfo.ConnectionInfo.DatabaseName = database1.strDatabaseName;
        //    crLogonInfo.ConnectionInfo.UserID = database1.strUserID;
        //    crLogonInfo.ConnectionInfo.Password = database1.strPassword;
        //    rptDocument.Database.Tables[0].ApplyLogOnInfo(crLogonInfo);
        //}

        public void Find_Record_GRN(string GRN_Tr_No)
        {
            database1 clsdatabase1 = new database1();
            INPR      clsINPR      = new INPR();
            DataSet   ds           = new DataSet();

            ds = clsINPR.Find_Record_GRN(mSys_System.pComp_ID, GRN_Tr_No);
            if (clsINPR.sErrorCode != "")
            {
                clsHomeScreen.Display_Message("MsgDBError : " + " '" + clsdatabase1.sErrorCode + "'", false);
                return;
            }
            if (clsINPR.sErrorCode != "")
            {
                clsHomeScreen.Display_Message(clsINPR.sErrorCode + "'", false);
                return;
            }
            if (ds.Tables.Count > 1)
            {
                DataTable dt = ds.Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    lblGRN_Inv_SqNo.Text = dt.Rows[i]["Inv_SqNo"].ToString();
                    txtGRN_Tr_No.Text    = dt.Rows[i]["Tr_No"].ToString();
                    dtpGRN_Tr_Date.Text  = dt.Rows[i]["Tr_Date"].ToString();

                    lookSub_ID.EditValue = dt.Rows[i]["Sub__ID"].ToString();

                    cmbDept_ID.EditValue       = (dt.Rows[i]["Dept_ID"] == null || dt.Rows[i]["Dept_ID"].ToString() == "" ? "-1" : dt.Rows[i]["Dept_ID"]);
                    cmbDept_ID_Store.EditValue = (dt.Rows[i]["Dept_ID_Store"] == null || dt.Rows[i]["Dept_ID_Store"].ToString() == "" ? "-1" : dt.Rows[i]["Dept_ID_Store"]);
                    cmbDept_ID_Store.Enabled   = false;
                    cmbDept_ID.Enabled         = false;

                    lookCredit_ID.EditValue = (dt.Rows[i]["Credit_ID"] == null || dt.Rows[i]["Credit_ID"].ToString() == "" ? "-1" : dt.Rows[i]["Credit_ID"]);
                    //cmbCC.EditValue = (dt.Rows[i]["cmbCC"] == null || dt.Rows[i]["cmbCC"].ToString() == "" ? "-1" : dt.Rows[i]["cmbCC"]);

                    txtAmt_Item.Text  = dt.Rows[i]["Amt_Item"].ToString();
                    txtAmt_Total.Text = dt.Rows[i]["Amt_Total"].ToString();
                    txtAmt_CC.Text    = dt.Rows[i]["Amt_CC"].ToString();
                    txtAmt_Cash.Text  = dt.Rows[i]["Amt_Cash"].ToString();
                    txtAmt_Dis.Text   = dt.Rows[i]["Amt_Dis"].ToString();
                    txtAmt_Bal.Text   = dt.Rows[i]["Amt_Bal"].ToString();
                    //lblTrLevel.Text = dt.Rows[i]["TrLevel"].ToString();
                    //lblTrLevelD.Text = dt.Rows[i]["TrLevelD"].ToString();
                    txtRef1.Text = dt.Rows[i]["Ref1"].ToString();

                    txtInv_No.Text = dt.Rows[i]["Party_InvNo"].ToString();
                    txtGP_No.Text  = dt.Rows[i]["GP_No"].ToString();

                    dtpGP_Date.Text = dt.Rows[i]["GP_Date"].ToString();
                }
                DataTable dt1 = ds.Tables[1];
                gridControl1.DataSource = dt1;
                Set_TrLevel();
            }
        }
Beispiel #3
0
        private void Fill_Combo()
        {
            database1 clsdatabase1 = new database1();
            INPR      clsINPR      = new INPR();
            DataSet   ds           = clsINPR.Fill_Combo(mSys_System.pComp_ID, mSys_System.pUser_ID);

            if (clsINPR.sErrorCode != "")
            {
                clsHomeScreen.Display_Message("MsgDBError : " + " '" + clsdatabase1.sErrorCode + "'", false);
                return;
            }
            Set_Combo(lookBranch_ID, ds.Tables[0], "Branch_SName", "Branch_ID", true);
            Set_Combo(lookCredit_ID, ds.Tables[1], "CreditD", "CReditID", true);
            Set_Combo(lookDType, ds.Tables[2], "DType_DD", "DType_ID", true);
        }
Beispiel #4
0
        private void Fill_SubCat()
        {
            INPR      clsINPR = new INPR();
            DataSet   ds      = clsINPR.Fill_SCat(mSys_System.pComp_ID, mSys_System.pUser_ID);
            DataTable dt      = ds.Tables[0];
            DataRow   row     = dt.NewRow();

            row["SCat_DD"] = string.Empty;
            row["SCat_ID"] = 0;
            dt.Rows.InsertAt(row, 0);
            repositoryItemGridLookUpEdit1.DataSource    = dt;
            repositoryItemGridLookUpEdit1.ValueMember   = "SCat_ID";
            repositoryItemGridLookUpEdit1.DisplayMember = "SCat_DD";
            gridView1.Columns["SCat_ID"].ColumnEdit     = repositoryItemGridLookUpEdit1;
        }
Beispiel #5
0
        private void btn_Rollback_Click(object sender, ItemClickEventArgs e)
        {
            int  nRet_Val = 0;
            INPR clsINPR  = new INPR();

            if (lblInv_SqNo.Text == "")
            {
                clsHomeScreen.Display_Message("Please select a record to Rollback...", false);
                return;
            }

            //---user authorizations
            //if (!(pUser_Auth(pcU_M_09_C03_D, 1, 1)))
            //{
            //    return;
            //}

            //---alert
            if (MessageBox.Show(cnMsg_BeforeRollback, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            //strAuth_D = mSys_IN.pcU_M_01_C09_RB;
            nRet_Val = clsINPR.Save_Rollback(Convert.ToInt32(lblInv_SqNo.Text), Convert.ToInt32(lblTrLevel.Text), mSys_System.pComp_ID, mSys_System.pBranch_ID, mSys_System.pUserName, mSys_System.pUser_ID, strAuth_D, mSys_System.pFY_ID);
            if (clsINPR.strErrorCode.Trim() != "")
            {
                clsHomeScreen.Display_Message(cnMsg_ErrSaveUpdate + clsINPR.strErrorCode + "....................", false);
                return;
            }
            if (nRet_Val == 1)
            {
                clsHomeScreen.Display_Message(cnMsg_SaveUpdateComplete, false);
                if (lblTrLevel.Text == mSys_System.pTrLevel_Cleared.ToString())
                {
                    lblTrLevel.Text = mSys_System.pTrLevel_Pending.ToString();
                }

                Set_TrLevel();
                //Fill_Grid();
                return;
            }
            else if (nRet_Val == -1)
            {
                clsHomeScreen.Display_Message(clsINPR.strErr_Msg, false);
                return;
            }
        }
Beispiel #6
0
        private bool Save_Update(int IsUpdate)
        {
            INPR clsINPR       = new INPR();
            int  Ret_EditValue = 0;

            if (IsUpdate == 0)
            {
                //---alert
                //strAuth_D = mSys_IN.pcU_M_01_C09_S;
                if (MessageBox.Show(Msg_BeforeSave, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return(false);
                }
            }
            else if (IsUpdate == 1) //---update
            {
                //strAuth_D = mSys_IN.pcU_M_01_C09_U;
                //---alert
                if (MessageBox.Show(Msg_BeforeUpdate, string.Empty, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return(false);
                }
            }

            DataTable dt_1 = Set_Grid();

            for (int i = 0; i < gridView1.DataRowCount; i++)
            {
                DataRow row = dt_1.NewRow();
                if (gridView1.GetRowCellValue(i, "Item_ID") != null)
                {
                    if (gridView1.GetRowCellValue(i, "Item_ID").ToString() != "0")
                    {
                        row["Item_ID"]       = gridView1.GetRowCellValue(i, "Item_ID");
                        row["SCat_ID"]       = gridView1.GetRowCellValue(i, "SCat_ID");
                        row["R_Qty"]         = gridView1.GetRowCellValue(i, "R_Qty");
                        row["R_Qty_Damaged"] = gridView1.GetRowCellValue(i, "R_Qty_Damaged");
                        row["R_Qty_Reject"]  = gridView1.GetRowCellValue(i, "R_Qty_Reject");
                        row["R_Rate"]        = gridView1.GetRowCellValue(i, "R_Rate");
                        row["R_Rate_FCY"]    = gridView1.GetRowCellValue(i, "R_Rate");
                        row["Rate_1"]        = gridView1.GetRowCellValue(i, "Rate_1");
                        row["Ref4"]          = gridView1.GetRowCellValue(i, "Ref4");
                        dt_1.Rows.Add(row);
                    }
                }
            }
            List <DataRow> Child = new List <DataRow>(dt_1.Select());


            string TrType        = "Cash";
            int    CC            = 0;
            int    Credit_ID     = 0;
            int    Dept_ID       = 0;
            int    Dept_ID_Store = 0;
            int    nTrLevel      = 0;

            lblPO_For.Text = "Credit";

            double Amt_Cash         = txtAmt_Cash.Text == "" ? 0 : Convert.ToDouble(txtAmt_Cash.Text);
            double Amt_CC           = txtAmt_CC.Text == "" ? 0 : Convert.ToDouble(txtAmt_CC.Text);
            double Amt_Bal          = txtAmt_Bal.Text == "" ? 0 : Convert.ToDouble(txtAmt_Bal.Text);
            double Amt_Item         = txtAmt_Item.Text == "" ? 0 : Convert.ToDouble(txtAmt_Item.Text);
            double Amt_Total        = txtAmt_Total.Text == "" ? 0 : Convert.ToDouble(txtAmt_Total.Text);
            double Amt_Dis          = txtAmt_Dis.Text == "" ? 0 : Convert.ToDouble(txtAmt_Dis.Text);
            double Qty_Item         = Convert.ToDouble(gridView1.Columns["R_Qty"].SummaryItem.SummaryValue);
            double Qty_Item_Reject  = Convert.ToDouble(gridView1.Columns["R_Qty_Reject"].SummaryItem.SummaryValue);
            double Qty_Item_Damaged = Convert.ToDouble(gridView1.Columns["R_Qty_Damaged"].SummaryItem.SummaryValue);
            double Curr_Rate        = txtCurr_Rate.Text == "" ? 1 : Convert.ToDouble(txtCurr_Rate.Text);
            double GST_Total        = Convert.ToDouble(gridView1.Columns["Amt_R1"].SummaryItem.SummaryValue);

            if (cmbCC.EditValue != null && cmbCC.EditValue.ToString() != "")
            {
                CC = Convert.ToInt32(cmbCC.EditValue.ToString());
            }
            if (lookCredit_ID.EditValue != null && lookCredit_ID.EditValue.ToString() != "")
            {
                Credit_ID = Convert.ToInt32(lookCredit_ID.EditValue.ToString());
            }
            if (cmbDept_ID.EditValue != null && cmbDept_ID.EditValue.ToString() != "")
            {
                Dept_ID = Convert.ToInt32(cmbDept_ID.EditValue.ToString());
            }
            if (cmbDept_ID_Store.EditValue != null && cmbDept_ID_Store.EditValue.ToString() != "")
            {
                Dept_ID_Store = Convert.ToInt32(cmbDept_ID_Store.EditValue.ToString());
            }
            if (lblTrLevel.Text != "")
            {
                nTrLevel = Convert.ToInt32(lblTrLevel.Text);
            }

            Ret_EditValue = clsINPR.Save_Master(lblInv_SqNo.Text, txtTr_No.Text.Trim(), Convert.ToDateTime(dtpTr_Date.EditValue).Date,
                                                lblGRN_Inv_SqNo.Text, txtGRN_Tr_No.Text.Trim(), Convert.ToDateTime(dtpGRN_Tr_Date.EditValue).Date,
                                                lblCurrID.Text.Trim(), Curr_Rate, GST_Total, Qty_Item,
                                                Convert.ToInt32(lookSub_ID.GetColumnValue("Detail_ID")), Convert.ToInt32(lookSub_ID.GetColumnValue("Sub_ID")), Dept_ID, Dept_ID_Store, mSys_System.pBranch_ID,
                                                Credit_ID, TrType, txtInv_No.Text.Trim(), txtGP_No.Text.Trim(), Convert.ToDateTime(dtpGP_Date.EditValue), txtRef1.Text,
                                                Amt_Cash, Amt_CC, Amt_Dis, Amt_Item, Amt_Total, Amt_Bal, CC, chkGrade_ID.Checked,
                                                Child, mSys_System.pComp_ID,
                                                mSys_System.pUserName, mSys_System.pUser_ID, nTrLevel, IsUpdate, strAuth_D
                                                );
            if (clsINPR.sErrorCode != "")
            {
                clsHomeScreen.Display_Message(clsINPR.sErrorCode + "......", false);
                return(false);
            }
            if (Ret_EditValue == -1)
            {
                clsHomeScreen.Display_Message(clsINPR.strErr_Msg + "....................", false);
                return(false);
            }
            if (Ret_EditValue == 0)
            {
                clsHomeScreen.Display_Message(Msg_ErrSaveUpdate + "....................", false);
                return(false);
            }
            if (Ret_EditValue == 1)
            {
                txtTr_No.Text    = clsINPR.str_Code;
                lblInv_SqNo.Text = clsINPR.str_ID.ToString();
                lblTrLevel.Text  = mSys_System.pTrLevel_Pending.ToString();
                Set_TrLevel();
                clsHomeScreen.Display_Message(Msg_SaveUpdateComplete + "....................", false);
            }

            return(true);
        }