Ejemplo n.º 1
0
        private void frmGeneralInvoiceMst_Load(object sender, EventArgs e)
        {
            SetMyControls();
            if (s1 == "&Add")
            {
                txtDebitPartyCode.Focus();
                txtserial.Text          = "S";
                txtSerialNo.Text        = getNewInvoiceDocumentNo().PadLeft(6, '0');
                dtInvoiceDate.EditValue = DateTime.Now;
            }
            if (s1 == "Edit")
            {
                DataSet ds = ProjectFunctions.GetDataSet("[sp_LoadInvoiceDataForEditing] '" + ImDate.Date.ToString("yyyy-MM-dd") + "','" + ImNo + "'");

                dtInvoiceDate.Text     = ds.Tables[0].Rows[0]["ImDate"].ToString();
                txtNetAmount.Text      = ds.Tables[0].Rows[0]["ImNetAmt"].ToString();
                txtRNetAmount.Text     = ds.Tables[0].Rows[0]["ImNetAmtRO"].ToString();
                txtTaxableAmount.Text  = ds.Tables[0].Rows[0]["ImTxbAmt"].ToString();
                txtTaxAmount.Text      = ds.Tables[0].Rows[0]["ImTaxAmt"].ToString();
                txtSurcharge.Text      = ds.Tables[0].Rows[0]["ImSTaxAmt"].ToString();
                txtValueOfGoods.Text   = ds.Tables[0].Rows[0]["ImTxbAmt"].ToString();
                txtDebitPartyCode.Text = ds.Tables[0].Rows[0]["ImPartyCode"].ToString();
                txtDebitPartyName.Text = ds.Tables[0].Rows[0]["AccName"].ToString();
                txtserial.Text         = ds.Tables[0].Rows[0]["ImType"].ToString();
                txtSerialNo.Text       = ds.Tables[0].Rows[0]["ImNo"].ToString();
                txtLCTag.Text          = ds.Tables[0].Rows[0]["ImLC"].ToString();
                txtCForm.Text          = ds.Tables[0].Rows[0]["ImCForm"].ToString();
                txtVatInvoice.Text     = ds.Tables[0].Rows[0]["ImVRTag"].ToString();

                dt = ds.Tables[1];
                InfoGrid.DataSource = dt;
                InfoGridView.BestFitColumns();
            }
        }
Ejemplo n.º 2
0
        private void BtnOK_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                if (BtnOK.Text.Trim().ToUpper() == "&OK")
                {
                    DataRow NewRow = dt.NewRow();

                    NewRow["PrdCode"]     = Convert.ToDecimal(txtPrdCode.Text);
                    NewRow["PrdAsgnCode"] = txtPrdAsgnCode.Text.Trim();
                    NewRow["PrdName"]     = txtProductName.Text.Trim();
                    NewRow["Quantity"]    = Convert.ToDecimal(txtQty.Text);
                    dt.Rows.Add(NewRow);
                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                    else
                    {
                        InfoGrid.DataSource = null;
                    }
                    BtnUndo.PerformClick();
                }
                if (BtnOK.Text.Trim().ToUpper() == "&UPDATE")
                {
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["PrdCode"], Convert.ToDecimal(txtPrdCode.Text));
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["PrdAsgnCode"], txtPrdAsgnCode.Text.Trim());
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["PrdName"], txtProductName.Text.Trim());
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Quantity"], Convert.ToDecimal(txtQty.Text));
                    InfoGridView.RefreshData();
                    BtnUndo.PerformClick();
                }
            }
        }
Ejemplo n.º 3
0
        private void FrmProformaMst_Load(object sender, EventArgs e)
        {
            SetMyControls();
            if (S1 == "&Add")
            {
                txtPIDate.EditValue = DateTime.Now;
                txtPINo.Text        = GetNewInvoiceDocumentNo().PadLeft(6, '0');
            }
            if (S1 == "Edit")
            {
                txtPIDate.Enabled = false;
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadPIMstFEDit '" + DocNo + "','" + Convert.ToDateTime(DocDate).ToString("yyyy-MM-dd") + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtPIDate.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["PIDate"]);
                    txtPINo.Text        = ds.Tables[0].Rows[0]["PINo"].ToString();
                    txtAccCode.Text     = ds.Tables[0].Rows[0]["PIPartyCode"].ToString();
                    txtAccName.Text     = ds.Tables[0].Rows[0]["AccName"].ToString();
                    dt = ds.Tables[1];



                    InvoiceGrid.DataSource = dt;
                    InvoiceGridView.BestFitColumns();
                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                }
            }
        }
        private void ApprovaLReturn_Load(object sender, EventArgs e)
        {
            try

            {
                ProjectFunctions.TextBoxVisualize(this);
                ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);
                if (S1 == "&Add")
                {
                    txtReturnDate.EditValue = DateTime.Now.ToString("dd-MM-yyyy");
                    txtCustMobileNo.Focus();
                }
                if (S1 == "Edit")
                {
                    DataSet ds = ProjectFunctions.GetDataSet("[sp_LoadArticleApprovalMstFEdit] '" + ImDate.Date.ToString("yyyy-MM-dd") + "','" + ImNo + "','" + ImSeries + "','" + GlobalVariables.CUnitID + "'");

                    txtReturnDate.Text   = Convert.ToDateTime(ds.Tables[0].Rows[0]["BillDate"]).ToString("yyyy-MM-dd");
                    txtReturnNo.Text     = ds.Tables[0].Rows[0]["BillNo"].ToString();
                    txtCustMobileNo.Text = ds.Tables[0].Rows[0]["CAFMOBILE"].ToString();
                    txtCustCode.Text     = ds.Tables[0].Rows[0]["CustCode"].ToString();
                    txtCustName.Text     = ds.Tables[0].Rows[0]["CAFFNAME"].ToString();
                    txtCustDetails.Text  = ds.Tables[0].Rows[0]["CAFADD"].ToString();
                    txtRemarks.Text      = ds.Tables[0].Rows[0]["SIMRemarks"].ToString();

                    dt = ds.Tables[1];
                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                    txtCustMobileNo.Focus();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
        private void LoadSheet()
        {
            dt.Rows.Clear();
            DevExpress.Spreadsheet.Workbook workbook = new DevExpress.Spreadsheet.Workbook();
            workbook.LoadDocument(openFileDialog1.FileName);
            DevExpress.Spreadsheet.Worksheet worksheet = workbook.Worksheets[i];
            if (i <= workbook.Sheets.Count)
            {
                txtStoreCode.Text = worksheet.Name;

                DataTable TempTable = new DataTable();


                string xlConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + txtAddress.Text + ";Extended Properties=\"Excel 12.0;\";";
                using (var myCommand = new OleDbDataAdapter("SELECT [EAN Code],[PI Qty] as [PI Qty] FROM [" + txtStoreCode.Text + "$]", xlConn))
                {
                    myCommand.Fill(TempTable);
                    if (TempTable.Rows.Count > 0)
                    {
                        foreach (DataRow dr in TempTable.Rows)
                        {
                            DataSet ds = ProjectFunctions.GetDataSet("sp_LoadEANDataNew '" + dr["EAN Code"].ToString() + "'");
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                DataRow dataRow = dt.NewRow();

                                dataRow["ARTNO"]      = ds.Tables[0].Rows[0]["ARTNO"].ToString();
                                dataRow["ARTALIAS"]   = ds.Tables[0].Rows[0]["ARTALIAS"].ToString();
                                dataRow["VARIANTART"] = ds.Tables[0].Rows[0]["VARIANT ART"].ToString();
                                dataRow["ARTMRP"]     = ds.Tables[0].Rows[0]["ARTMRP"].ToString();
                                dataRow["SIZE"]       = ds.Tables[0].Rows[0]["SIZE"].ToString();
                                dataRow["COLOR"]      = ds.Tables[0].Rows[0]["COLOR"].ToString();
                                dataRow["COLSYSID"]   = ds.Tables[0].Rows[0]["COLSYSID"].ToString();
                                dataRow["SZSYSID"]    = ds.Tables[0].Rows[0]["SZSYSID"].ToString();
                                dataRow["ARTSYSID"]   = ds.Tables[0].Rows[0]["ARTSYSID"].ToString();
                                dataRow["GrpDesc"]    = ds.Tables[0].Rows[0]["GrpDesc"].ToString();
                                dataRow["GrpSubDesc"] = ds.Tables[0].Rows[0]["GrpSubDesc"].ToString();
                                if (dr["PI Qty"].ToString().Trim().Length == 0)
                                {
                                    dr["PI Qty"] = 0;
                                }
                                dataRow["PIQty"] = Convert.ToDecimal(dr["PI Qty"]);
                                dataRow["EANNo"] = Convert.ToDecimal(dr["EAN Code"]);

                                dataRow["GrpHSNCode"] = ds.Tables[0].Rows[0]["GrpHSNCode"].ToString();
                                dt.Rows.Add(dataRow);
                            }
                        }


                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                }
            }
            else
            {
                XtraMessageBox.Show("PIS Created Successfully");
            }
        }
        private void HelpGrid_DoubleClick(object sender, EventArgs e)
        {
            DataRow currentrow = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle);

            if (HelpGrid.Text == "SKU")
            {
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadSKUForPI '" + currentrow["SKUVOUCHNO"].ToString() + "' ,'" + currentrow["SKUFNYR"].ToString() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dt = ds.Tables[0];
                    InfoGrid.DataSource = ds.Tables[0];
                    InfoGridView.BestFitColumns();
                    HelpGrid.Visible = false;
                }
                else
                {
                    InfoGrid.DataSource = null;
                    InfoGridView.BestFitColumns();
                }
            }
            if (HelpGrid.Text == "STORE")
            {
                txtStoreCode.Text = currentrow["AccDCCode"].ToString();
                HelpGrid.Visible  = false;
            }
        }
Ejemplo n.º 7
0
        private void FrmImportSaleGSTDiffData_Load(object sender, EventArgs e)
        {
            ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);
            if (S1 == "&Add")
            {
                txtDocNo.Text        = GetNewDocCode().PadLeft(10, '0');
                txtDocDate.EditValue = DateTime.Now;
            }
            if (S1 == "Edit")
            {
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadGSTSaleDiffMstFEdit '" + DocNo + "','" + Convert.ToDateTime(DocDate).ToString("yyyy-MM-dd") + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtDocDate.EditValue   = Convert.ToDateTime(ds.Tables[0].Rows[0]["DocDate"]);
                    txtDocNo.Text          = ds.Tables[0].Rows[0]["DocNo"].ToString();
                    txtDebitPartyCode.Text = ds.Tables[0].Rows[0]["AccCode"].ToString();
                    txtDebitPartyName.Text = ds.Tables[0].Rows[0]["AccName"].ToString();

                    txtFromDate.EditValue = Convert.ToDateTime(ds.Tables[1].Rows[0]["FromDate"]);
                    txtToDate.EditValue   = Convert.ToDateTime(ds.Tables[1].Rows[0]["ToDate"]);

                    dt = ds.Tables[0];
                    InfoGrid.DataSource = dt;

                    InfoGridView.BestFitColumns();
                    SimpleButton4_Click(null, e);
                }
            }
        }
Ejemplo n.º 8
0
        private void HelpGrid_DoubleClick(object sender, EventArgs e)
        {
            DataRow row = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle);

            if (HelpGrid.Text == "txtAccCode")
            {
                txtAccCode.Text  = row["AccCode"].ToString();
                txtAccName.Text  = row["AccName"].ToString();
                HelpGrid.Visible = false;
                txtAccCode.Focus();
            }
            if (HelpGrid.Text == "Load")
            {
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadEANData '" + row[0].ToString() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    AddRowsToDatatable();
                    dt = ds.Tables[0];
                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                    HelpGrid.Visible = false;
                }
                else
                {
                    InfoGrid.DataSource = null;
                }
            }
        }
        private void OpenFileDialog1_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            dt.Rows.Clear();


            var path = openFileDialog1.FileName;

            StreamReader sr = new StreamReader(path);
            int          j  = 0;

            while (sr.Peek() > 0)
            {
                int      i    = 0;
                string[] cols = sr.ReadLine().Split('\t');
                if (j > 0)
                {
                    DataRow newrow = dt.NewRow();

                    foreach (string str in cols)
                    {
                        newrow[i] = str.Trim();
                        i++;
                    }

                    dt.Rows.Add(newrow);
                }
                j++;
            }



            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    String  AccCode  = string.Empty;
                    DataSet dsActMst = ProjectFunctions.GetDataSet(" Select AccCode from ActMst where upper(AccName)='" + dr["Account"].ToString().Trim().ToUpper().Replace("'", string.Empty) + "'");
                    if (dsActMst.Tables[0].Rows.Count > 0)
                    {
                        dr["AccCode"] = dsActMst.Tables[0].Rows[0][0].ToString();
                    }
                }
                InfoGrid.DataSource = dt;
                InfoGridView.BestFitColumns();
            }
            else
            {
                InfoGrid.DataSource = null;
            }
        }
Ejemplo n.º 10
0
        private void OpenFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            dt.Rows.Clear();
            var xlConn = string.Empty;

            xlConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + openFileDialog1.FileName + ";Extended Properties=\"Excel 12.0;\";";
            using (var myCommand = new OleDbDataAdapter("SELECT '' as AccCode,[BILL DATE],[NET SALE VALUE] ,[NET SALE AFTER ADJ],[DISCOUNT],[USER ITEM CODE] FROM Sheet1$", xlConn))
            {
                myCommand.Fill(dt);

                InfoGrid.DataSource = dt;
                InfoGridView.BestFitColumns();
            }
        }
        private void BtnLoad_Click(object sender, EventArgs e)
        {
            foreach (DevExpress.XtraEditors.Controls.CheckedListBoxItem item in txtSize.Properties.Items)
            {
                if (item.CheckState == CheckState.Checked)
                {
                    foreach (DevExpress.XtraGrid.Columns.GridColumn col in InfoGridView.Columns)
                    {
                        if (item.Value.ToString().ToUpper() == col.FieldName.ToString().ToUpper())
                        {
                            col.Visible = true;
                            col.OptionsColumn.AllowEdit = true;
                        }
                    }
                }
            }

            DataTable dt = new DataTable();

            foreach (DevExpress.XtraGrid.Columns.GridColumn col in InfoGridView.Columns)
            {
                if (col.Visible)
                {
                    dt.Columns.Add(col.FieldName, typeof(string));
                }
            }
            foreach (DevExpress.XtraEditors.Controls.CheckedListBoxItem item in txtMeasurement.Properties.Items)
            {
                if (item.CheckState == CheckState.Checked)
                {
                    DataRow dr = dt.NewRow();
                    dr["MCode"] = item.Value;
                    dr["MDesc"] = item.Description;
                    dt.Rows.Add(dr);
                }
            }
            if (dt.Rows.Count > 0)
            {
                InfoGrid.DataSource = dt;
                InfoGridView.BestFitColumns();
            }
            else
            {
                InfoGrid.DataSource = null;
            }
        }
        private void FrmVoucherMstAddEdit_Load(object sender, EventArgs e)
        {
            SetMyControls();
            if (S1 == "&Add")
            {
                dtInvoiceDate.EditValue = DateTime.Now;
                txtVuType.Focus();
            }
            else
            {
                dtInvoiceDate.Enabled = false;
                txtVuType.Enabled     = false;
                var     str = "[sp_LoadVouDataFEditing] @VumNo='" + VoucherNo + "',@VumDate='" + Convert.ToDateTime(VoucherDate).ToString("yyyy-MM-dd") + "'";
                DataSet ds  = ProjectFunctions.GetDataSet(str);
                dtInvoiceDate.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["VumDate"]).ToString("yyyy-MM-dd");
                txtVuType.Text     = ds.Tables[0].Rows[0]["VumType"].ToString();
                txtVuDesc.Text     = ds.Tables[0].Rows[0]["VouDesc"].ToString();

                ds.Tables[1].Columns.Add("Credit", typeof(decimal));
                ds.Tables[1].Columns.Add("Debit", typeof(decimal));


                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    if (Convert.ToDecimal(dr["Amount"]) < 0)
                    {
                        dr["Credit"] = -Convert.ToDecimal(dr["Amount"]);
                        dr["CrDr"]   = "CR";
                        dr["Debit"]  = Convert.ToDecimal("0");
                    }
                    if (Convert.ToDecimal(dr["Amount"]) > 0)
                    {
                        dr["Debit"]  = Convert.ToDecimal(dr["Amount"]);
                        dr["CrDr"]   = "DR";
                        dr["Credit"] = Convert.ToDecimal("0");
                    }
                }


                dt = ds.Tables[1];
                InfoGrid.DataSource = dt;
                InfoGridView.BestFitColumns();
                txtAccCode.Focus();
            }
        }
        private void frmUnsoldMstAdd_Load(object sender, EventArgs e)
        {
            if (s1 == "&Add")
            {
                txtAgainstInvNo.Focus();
                txtserial.Text   = "S";
                txtSerialNo.Text = getNewInvoiceDocumentNo().PadLeft(6, '0');
            }
            if (s1 == "Edit")
            {
                DataSet ds = ProjectFunctions.GetDataSet("[LoadUnSoldDataForEditing] @InvDate='" + ImDate.Date.ToString("yyyy-MM-dd") + "',@Imno='" + ImNo + "'");
                txtInvoiceType.Text    = ds.Tables[0].Rows[0]["ImInvTypeHead"].ToString();
                dtInvoiceDate.Text     = ds.Tables[0].Rows[0]["ImDate"].ToString();
                txtSmCode.Text         = ds.Tables[0].Rows[0]["ImSalesManCode"].ToString();
                txtSMName.Text         = ds.Tables[0].Rows[0]["SMName"].ToString();
                txtRouteCode.Text      = ds.Tables[0].Rows[0]["ImRouteCode"].ToString();
                txtRouteName.Text      = ds.Tables[0].Rows[0]["RouteDesc"].ToString();
                txtNetAmount.Text      = ds.Tables[0].Rows[0]["ImNetAmt"].ToString();
                txtRNetAmount.Text     = ds.Tables[0].Rows[0]["ImNetAmtRO"].ToString();
                txtTaxableAmount.Text  = ds.Tables[0].Rows[0]["ImTxbAmt"].ToString();
                txtTaxAmount.Text      = ds.Tables[0].Rows[0]["ImTaxAmt"].ToString();
                txtSurcharge.Text      = ds.Tables[0].Rows[0]["ImSTaxAmt"].ToString();
                txtValueOfGoods.Text   = ds.Tables[0].Rows[0]["ImTxbAmt"].ToString();
                txtDebitPartyCode.Text = ds.Tables[0].Rows[0]["ImPartyCode"].ToString();
                txtDebitPartyName.Text = ds.Tables[0].Rows[0]["PartyName"].ToString();
                txtSUSType.Text        = ds.Tables[0].Rows[0]["ImType"].ToString();
                txtserial.Text         = ds.Tables[0].Rows[0]["ImNoSeries"].ToString();
                txtSerialNo.Text       = ds.Tables[0].Rows[0]["ImNo"].ToString();
                txtLCTag.Text          = ds.Tables[0].Rows[0]["ImLC"].ToString();
                txtCForm.Text          = ds.Tables[0].Rows[0]["ImCForm"].ToString();
                txtRouteCode.Text      = ds.Tables[0].Rows[0]["ImRouteCode"].ToString();
                txtRouteName.Text      = ds.Tables[0].Rows[0]["RouteDesc"].ToString();
                txtVatInvoice.Text     = ds.Tables[0].Rows[0]["ImVRTag"].ToString();
                txtAgainstInvNo.Text   = ds.Tables[0].Rows[0]["IminNo"].ToString();
                txtAgainstInvDate.Text = ds.Tables[0].Rows[0]["IminDate"].ToString();
                OldAgainstInvDate      = Convert.ToDateTime(ds.Tables[0].Rows[0]["IminDate"]);
                OldAgainstInvNo        = ds.Tables[0].Rows[0]["IminNo"].ToString();

                dt = ds.Tables[1];
                InfoGrid.DataSource = dt;
                InfoGridView.BestFitColumns();
            }
        }
Ejemplo n.º 14
0
        private void FrmDealerOrderMaster_Load(object sender, EventArgs e)
        {
            SetMyControls();
            if (S1 == "&Add")
            {
                dtOrderDate.EditValue    = DateTime.Now;
                dtOrderForDate.EditValue = DateTime.Now;
                dtOrderForDate.Focus();
                txtOrderNo.Text = GetNewInvoiceDocumentNo().PadLeft(8, '0');

                DataSet ds = ProjectFunctions.GetDataSet("SP_LoadPrdForOrder");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dt = ds.Tables[0];
                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                }
                else
                {
                    InfoGrid.DataSource = null;
                }
            }
            if (S1 == "Edit")
            {
                txtDealerCode.Enabled = false;
                dtOrderForDate.Focus();
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadOrderDataFEditing '" + OrderNo + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    dtOrderDate.EditValue    = Convert.ToDateTime(ds.Tables[0].Rows[0]["OrdDate"]);
                    dtOrderForDate.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["OrdForDate"]);
                    txtOrderNo.Text          = ds.Tables[0].Rows[0]["OrdNo"].ToString();
                    txtDealerCode.Text       = ds.Tables[0].Rows[0]["OrdDealerCode"].ToString();
                    txtDealerName.Text       = ds.Tables[0].Rows[0]["AccName"].ToString();
                    dt = ds.Tables[1];
                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                }
            }
        }
        private void LoadDelAddresses()
        {
            DataSet ds = ProjectFunctions.GetDataSet("sp_LoadActDelAddresses '" + txtAcCode.Text + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                InfoGrid.DataSource = ds.Tables[0];
                InfoGridView.BestFitColumns();
            }
            else
            {
                InfoGrid.DataSource = null;
                InfoGridView.BestFitColumns();
            }

            txtDelAddress1.Text = string.Empty;
            txtDelAddress2.Text = string.Empty;
            txtDelAddress3.Text = string.Empty;
            txtDelCitycode.Text = string.Empty;
            txtDelCityName.Text = string.Empty;
            txtDelGSTNo.Text    = string.Empty;
            txtDelAccName.Text  = string.Empty;
            txtDelZipCode.Text  = string.Empty;
        }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                InfoGrid.RefreshDataSource();

                if (BtnOK.Text.ToUpper() == "&OK")
                {
                    InfoGrid.RefreshDataSource();
                    var dr = dt.NewRow();
                    dr["PrdCode"]     = Convert.ToDecimal(txtProductCode.Text);
                    dr["PrdAsgnCode"] = txtProductACode.Text;
                    dr["PrdName"]     = txtProductName.Text;
                    dr["Qty"]         = Convert.ToDecimal(txtProductQty.Text);
                    dr["Amount"]      = Convert.ToDecimal(txtAmount.Text);
                    dt.Rows.Add(dr);
                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                    BtnUndo.PerformClick();
                }
                if (BtnOK.Text.ToUpper() == "&UPDATE")
                {
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["PrdCode"], Convert.ToDecimal(txtProductCode.Text));
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["PrdAsgnCode"], txtProductACode.Text);
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["PrdName"], txtProductName.Text);
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Qty"], Convert.ToDecimal(txtProductQty.Text));
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Amount"], Convert.ToDecimal(txtAmount.Text));
                    InfoGridView.RefreshData();

                    BtnUndo.PerformClick();
                }
            }
        }
Ejemplo n.º 17
0
        private void TxtBarCode_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F3)
                {
                    HelpGridView.Columns.Clear();
                    HelpGrid.Text = "Load";


                    DataTable dtNew = new DataTable();


                    DataSet ds = ProjectFunctions.GetDataSet("sp_LoadDataFromSFDet_F3 '" + GlobalVariables.CUnitID + "'");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ds.Tables[0].Columns.Add("Select", typeof(bool));
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            dr["Select"] = false;
                            foreach (DataRow drdt in dt.Rows)
                            {
                                if (dr["SIDBARCODE"].ToString() == drdt["SIDBARCODE"].ToString())
                                {
                                    dr["Select"] = true;
                                    continue;
                                }
                            }
                        }
                        dtNew = ds.Tables[0].Clone();

                        foreach (DataRow drNewRow in ds.Tables[0].Select("Select=False"))
                        {
                            dtNew.ImportRow(drNewRow);
                        }



                        HelpGrid.DataSource = dtNew;
                        HelpGrid.Show();
                        HelpGrid.Focus();
                        HelpGridView.BestFitColumns();

                        HelpGridView.OptionsBehavior.Editable = true;
                        foreach (DevExpress.XtraGrid.Columns.GridColumn col in HelpGridView.Columns)
                        {
                            if (col.FieldName == "Select")
                            {
                                col.VisibleIndex            = 0;
                                col.OptionsColumn.AllowEdit = true;
                            }
                            else
                            {
                                col.OptionsColumn.AllowEdit = false;
                            }
                        }
                    }
                }
                if (e.KeyCode == Keys.Enter)
                {
                    DataSet ds = ProjectFunctions.GetDataSet("sp_LoadDataFromSKUdetUsingBarCode '" + txtBarCode.Text + "','" + GlobalVariables.CUnitID + "'");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["Used"].ToString().ToUpper() == "Y")
                        {
                            ProjectFunctions.SpeakError("BarCode Already Used In Some Other Document");
                            txtBarCode.Focus();
                            txtBarCode.SelectAll();
                            e.Handled = true;
                            return;
                        }
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["SIDBARCODE"].ToString().ToUpper() == txtBarCode.Text.Trim())
                            {
                                ProjectFunctions.SpeakError("BarCode Already Loaded In This Document");
                                txtBarCode.Focus();
                                txtBarCode.SelectAll();
                                e.Handled = true;
                                return;
                            }
                        }
                        if (Convert.ToDecimal(ds.Tables[0].Rows[0]["SIDARTMRP"]) != Convert.ToDecimal(ds.Tables[0].Rows[0]["ARTMRP"]))
                        {
                            ProjectFunctions.SpeakError("Difference In MRP( MRP In Article is - " + ds.Tables[0].Rows[0]["ARTMRP"].ToString() + ")");
                            txtBarCode.Focus();
                            txtBarCode.SelectAll();
                            e.Handled = true;
                            return;
                        }



                        if (dt.Rows.Count == 0)
                        {
                            dt = ds.Tables[0];
                        }
                        else
                        {
                            dt.Merge(ds.Tables[0]);
                        }

                        ShowImage(Convert.ToDecimal(ds.Tables[0].Rows[0]["SIDARTID"]).ToString());
                    }
                    else
                    {
                        ProjectFunctions.SpeakError("NO BarCode Found");
                        return;
                    }
                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                    else
                    {
                        InfoGrid.DataSource = null;
                    }
                    txtBarCode.Text = string.Empty;
                    txtBarCode.Focus();
                }
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError(ex.Message);
            }
            e.Handled = true;
        }
Ejemplo n.º 18
0
        private void HelpGrid_DoubleClick(object sender, EventArgs e)
        {
            try

            {
                DataRow row = HelpGridView.GetDataRow(HelpGridView.FocusedRowHandle);

                if (HelpGrid.Text == "txtCustMobileNo")
                {
                    txtCustMobileNo.Text = row["CAFMOBILE"].ToString();
                    txtCustCode.Text     = row["CAFSYSID"].ToString();
                    txtCustName.Text     = row["CAFFNAME"].ToString();
                    txtCustDetails.Text  = row["CAFADD"].ToString();
                    HelpGrid.Visible     = false;
                    txtBarCode.Focus();
                }


                if (HelpGrid.Text == "Load")
                {
                    foreach (DataRow dr in (HelpGrid.DataSource as DataTable).Rows)
                    {
                        if (dr["Select"].ToString().ToUpper() == "TRUE")
                        {
                            DataSet ds = ProjectFunctions.GetDataSet("sp_LoadDataFromSKUdetUsingBarCode '" + dr["SIDBARCODE"].ToString() + "','" + GlobalVariables.CUnitID + "'");
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                if (ds.Tables[0].Rows[0]["Used"].ToString().ToUpper() == "Y")
                                {
                                    ProjectFunctions.SpeakError("BarCode Already Used In Some Other Document");
                                    txtBarCode.Focus();
                                    txtBarCode.SelectAll();

                                    return;
                                }
                                foreach (DataRow drNew in dt.Rows)
                                {
                                    if (drNew["SIDBARCODE"].ToString().ToUpper() == dr["SIDBARCODE"].ToString())
                                    {
                                        ProjectFunctions.SpeakError("BarCode Already Loaded In This Document");
                                        txtBarCode.Focus();
                                        txtBarCode.SelectAll();

                                        return;
                                    }
                                }
                                if (Convert.ToDecimal(ds.Tables[0].Rows[0]["SIDARTMRP"]) != Convert.ToDecimal(ds.Tables[0].Rows[0]["ARTMRP"]))
                                {
                                    ProjectFunctions.SpeakError("Difference In MRP( MRP In Article is - " + ds.Tables[0].Rows[0]["ARTMRP"].ToString() + ")");
                                    txtBarCode.Focus();
                                    txtBarCode.SelectAll();

                                    return;
                                }

                                if (dt.Rows.Count == 0)
                                {
                                    dt = ds.Tables[0];
                                }
                                else
                                {
                                    dt.Merge(ds.Tables[0]);
                                }
                            }
                            else
                            {
                                ProjectFunctions.SpeakError("NO BarCode Found");
                                return;
                            }
                        }
                    }

                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                    else
                    {
                        InfoGrid.DataSource = null;
                    }
                    txtBarCode.Text  = string.Empty;
                    HelpGrid.Visible = false;
                    txtBarCode.Focus();
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
        private void FrmPIGeneration2_Load(object sender, EventArgs e)
        {
            SetMyControls();
            if (S1 == "&Add")
            {
                txtPIDate.EditValue = DateTime.Now;
                txtPINo.Text        = GetNewInvoiceDocumentNo().PadLeft(6, '0');
            }
            if (S1 == "Edit")
            {
                txtPIDate.Enabled = false;
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadPIMstNewFEDit '" + DocNo + "','" + Convert.ToDateTime(DocDate).ToString("yyyy-MM-dd") + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtPIDate.EditValue = Convert.ToDateTime(ds.Tables[0].Rows[0]["PIDate"]);
                    txtPINo.Text        = ds.Tables[0].Rows[0]["PINo"].ToString();
                    txtStoreCode.Text   = ds.Tables[0].Rows[0]["PIStoreCode"].ToString();

                    // DataTable TempTable = new DataTable();
                    //TempTable = ds.Tables[1];


                    //foreach (DataRow dr in TempTable.Rows)
                    //{
                    //    DataSet dsInner = ProjectFunctions.GetDataSet("sp_LoadEANDataNew '" + dr["EANNo"].ToString() + "'");
                    //    if (dsInner.Tables[0].Rows.Count > 0)
                    //    {
                    //        DataRow = dt.NewRow();

                    //        dataRow["ARTNO"] = dsInner.Tables[0].Rows[0]["ARTNO"].ToString();
                    //        dataRow["ARTALIAS"] = dsInner.Tables[0].Rows[0]["ARTALIAS"].ToString();
                    //        dataRow["VARIANTART"] = dsInner.Tables[0].Rows[0]["VARIANT ART"].ToString();
                    //        dataRow["ARTMRP"] = dsInner.Tables[0].Rows[0]["ARTMRP"].ToString();
                    //        dataRow["SIZE"] = dsInner.Tables[0].Rows[0]["SIZE"].ToString();
                    //        dataRow["COLOR"] = dsInner.Tables[0].Rows[0]["COLOR"].ToString();
                    //        dataRow["COLSYSID"] = dsInner.Tables[0].Rows[0]["COLSYSID"].ToString();
                    //        dataRow["SZSYSID"] = dsInner.Tables[0].Rows[0]["SZSYSID"].ToString();
                    //        dataRow["ARTSYSID"] = dsInner.Tables[0].Rows[0]["ARTSYSID"].ToString();
                    //        dataRow["GrpDesc"] = dsInner.Tables[0].Rows[0]["GrpDesc"].ToString();
                    //        dataRow["GrpSubDesc"] = dsInner.Tables[0].Rows[0]["GrpSubDesc"].ToString();



                    //        dataRow["PIQty"] = Convert.ToDecimal(dr["PIQty"]);
                    //        dataRow["EANNo"] = Convert.ToDecimal(dr["EANNo"]);

                    //        dataRow["GrpHSNCode"] = dsInner.Tables[0].Rows[0]["GrpHSNCode"].ToString();
                    //        dt.Rows.Add(dataRow);
                    //    }
                    //}


                    //foreach (DataRow dr in TempTable.Rows)
                    //{

                    //    foreach (DataRow dr2 in ds.Tables[2].Rows)
                    //    {
                    //        if (dr["EANNo"].ToString().ToUpper() == dr2["EAN NUMBER"].ToString().ToUpper())
                    //        {
                    //            DataRow = dt.NewRow();

                    //            dataRow["ARTNO"] = dr2["ARTNO"].ToString();
                    //            dataRow["ARTALIAS"] = dr2["ARTALIAS"].ToString();
                    //            dataRow["VARIANTART"] = dr2["VARIANT ART"].ToString();
                    //            dataRow["ARTMRP"] = dr2["ARTMRP"].ToString();
                    //            dataRow["SIZE"] = dr2["SIZE"].ToString();
                    //            dataRow["COLOR"] = dr2["COLOR"].ToString();
                    //            dataRow["COLSYSID"] = dr2["COLSYSID"].ToString();
                    //            dataRow["SZSYSID"] = dr2["SZSYSID"].ToString();
                    //            dataRow["ARTSYSID"] = dr2["ARTSYSID"].ToString();
                    //            dataRow["GrpDesc"] = dr2["GrpDesc"].ToString();
                    //            dataRow["GrpSubDesc"] = dr2["GrpSubDesc"].ToString();
                    //            dataRow["PIQty"] = Convert.ToDecimal(dr["PIQty"]);
                    //            dataRow["EANNo"] = Convert.ToDecimal(dr["EANNo"]);
                    //            dataRow["GrpHSNCode"] = dr2["GrpHSNCode"].ToString();
                    //            dt.Rows.Add(dataRow);
                    //            break;
                    //        }

                    //    }

                    //}


                    dt = ds.Tables[1];
                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                    else
                    {
                        InfoGrid.DataSource = null;
                        InfoGridView.BestFitColumns();
                    }
                }
            }
        }
        private void TxtBarCode_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                //if (e.KeyCode == Keys.F3)
                //{
                //    HelpGridView.Columns.Clear();
                //    HelpGrid.Text = "Load";
                //    DataSet ds = ProjectFunctions.GetDataSet("sp_LoadDataFromSFDet_F3 '" + GlobalVariables.CUnitID + "'");
                //    if (ds.Tables[0].Rows.Count > 0)
                //    {
                //        ds.Tables[0].Columns.Add("Select", typeof(bool));
                //        foreach (DataRow dr in ds.Tables[0].Rows)
                //        {
                //            dr["Select"] = false;
                //        }
                //        HelpGrid.DataSource = ds.Tables[0];
                //        HelpGrid.Show();
                //        HelpGrid.Focus();
                //        HelpGridView.BestFitColumns();

                //        HelpGridView.OptionsBehavior.Editable = true;
                //        foreach (DevExpress.XtraGrid.Columns.GridColumn col in HelpGridView.Columns)
                //        {
                //            if (col.FieldName == "Select")
                //            {
                //                col.VisibleIndex = 0;
                //                col.OptionsColumn.AllowEdit = true;
                //            }
                //            else
                //            {
                //                col.OptionsColumn.AllowEdit = false;
                //            }
                //        }
                //    }

                //}
                if (e.KeyCode == Keys.Enter)
                {
                    DataSet ds = ProjectFunctions.GetDataSet("sp_LoadDataFromSKUdetForApprovalReturn '" + txtBarCode.Text + "','" + txtCustCode.Text + "','" + GlobalVariables.CUnitID + "'");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (ds.Tables[0].Rows[0]["Used"].ToString().ToUpper() == "N")
                        {
                            ProjectFunctions.SpeakError("BarCode Already Used In Some Other Document");
                            txtBarCode.Focus();
                            txtBarCode.SelectAll();
                            e.Handled = true;
                            return;
                        }
                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr["SIDBARCODE"].ToString().ToUpper() == txtBarCode.Text.Trim())
                            {
                                ProjectFunctions.SpeakError("BarCode Already Loaded In This Document");
                                txtBarCode.Focus();
                                txtBarCode.SelectAll();
                                e.Handled = true;
                                return;
                            }
                        }
                        //if (Convert.ToDecimal(ds.Tables[0].Rows[0]["SIDARTMRP"]) != Convert.ToDecimal(ds.Tables[0].Rows[0]["ARTMRP"]))
                        //{
                        //    ProjectFunctions.SpeakError("Difference In MRP( MRP In Articel is - " + ds.Tables[0].Rows[0]["ARTMRP"].ToString() + ")");
                        //    txtBarCode.Focus();
                        //    txtBarCode.SelectAll();
                        //    e.Handled = true;

                        //}



                        if (dt.Rows.Count == 0)
                        {
                            dt = ds.Tables[0];
                        }
                        else
                        {
                            dt.Merge(ds.Tables[0]);
                        }

                        ShowImage(Convert.ToDecimal(ds.Tables[0].Rows[0]["SIDARTID"]).ToString());
                    }
                    else
                    {
                        ProjectFunctions.SpeakError("No Approval Generated Against This BarCode Found");
                        txtBarCode.Focus();
                        txtBarCode.SelectAll();
                        e.Handled = true;
                        return;
                    }
                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                    else
                    {
                        InfoGrid.DataSource = null;
                    }
                    txtBarCode.Text = string.Empty;
                    txtBarCode.Focus();
                }
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError(ex.Message);
            }
            e.Handled = true;
        }
Ejemplo n.º 21
0
        private void HOSale()
        {
            dt.Clear();


            DataRow row1 = dt.NewRow();

            row1["Name"]   = "CashAmount";
            row1["Amount"] = 0.00;
            dt.Rows.Add(row1);

            DataRow row2 = dt.NewRow();

            row2["Name"]   = "CardAmount";
            row2["Amount"] = 0.00;
            dt.Rows.Add(row2);

            DataRow row3 = dt.NewRow();

            row3["Name"]   = "PG. Amount";
            row3["Amount"] = 0.00;

            dt.Rows.Add(row3);


            DataSet dsSale = ProjectFunctions.GetDataSet("sp_ShowRoomDashBoard '" + WorkingTag + "','" + GlobalVariables.CUnitID + "'");

            //DataSet dsSale = ProjectFunctions.GetDataSet("sp_ShowRoomDashBoard '" + WorkingTag + "','" + ('0' + (GlobalVariables.CUnitID)) + GlobalVariables.FinancialYear + "'");
            if (dsSale.Tables[0].Rows.Count > 0)
            {
                lblTotalSale.Text    = Convert.ToDecimal(dsSale.Tables[2].Rows[0][0]).ToString("0.00");
                lblTotalSaleQty.Text = Convert.ToDecimal(dsSale.Tables[0].Rows[0][0]).ToString("0.00");
                lblNoOfBills.Text    = Convert.ToDecimal(dsSale.Tables[1].Rows[0][0]).ToString("0.00");
                if ((Convert.ToDecimal(lblTotalSale.Text) > 0) && (Convert.ToDecimal(lblTotalSaleQty.Text) > 0))
                {
                    lblAverageBillSale.Text = (Convert.ToDecimal(lblTotalSale.Text) / Convert.ToDecimal(lblTotalSaleQty.Text)).ToString("0.00");
                }
                else
                {
                    lblAverageBillSale.Text = "0.00";
                }
                int j = 0;
                if (dsSale.Tables[3].Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (j == 0)
                        {
                            if (dr["Name"].ToString() == "CashAmount")
                            {
                                dr["Amount"] = Convert.ToDecimal(dsSale.Tables[3].Rows[0][0]);
                                j++;
                            }
                        }
                        if (j == 1)
                        {
                            if (dr["Name"].ToString() == "CardAmount")
                            {
                                dr["Amount"] = Convert.ToDecimal(dsSale.Tables[3].Rows[0][1]);
                                j++;
                            }
                        }
                        if (j == 2)
                        {
                            if (dr["Name"].ToString() == "PG. Amount")
                            {
                                dr["Amount"] = Convert.ToDecimal(dsSale.Tables[3].Rows[0][2]);
                                j++;
                            }
                        }
                    }

                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                }
                else
                {
                    InfoGrid.DataSource = dt;
                    InfoGridView.BestFitColumns();
                }
            }
        }
        private void BtnOK_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                InfoGrid.RefreshDataSource();
                if (BtnOK.Text.ToUpper() == "&OK")
                {
                    InfoGrid.RefreshDataSource();
                    var dr = dt.NewRow();
                    dr["AccCode"]   = txtAccCode.Text.Trim();
                    dr["AccName"]   = txtAccName.Text;
                    dr["Narration"] = txtNarration.Text;
                    if (txtDrCr.Text.ToUpper() == "DR")
                    {
                        dr["Debit"] = Convert.ToDecimal(txtAmount.Text);
                    }
                    else
                    {
                        dr["Debit"] = Convert.ToDecimal("0");
                    }
                    if (txtDrCr.Text.ToUpper() == "CR")
                    {
                        dr["Credit"] = Convert.ToDecimal(txtAmount.Text);
                    }
                    else
                    {
                        dr["Credit"] = Convert.ToDecimal("0");
                    }
                    dr["CrDr"]        = txtDrCr.Text;
                    dr["VutChequeNo"] = txtChqNo.Text;
                    if (txtChqDate.Text.Length > 0)
                    {
                        dr["VutChequeDate"] = Convert.ToDateTime(txtChqDate.Text).ToString("yyyy-MM-dd");
                    }
                    dt.Rows.Add(dr);
                    if (dt.Rows.Count > 0)
                    {
                        InfoGrid.DataSource = dt;
                        InfoGridView.BestFitColumns();
                    }
                }


                if (BtnOK.Text.ToUpper() == "&UPDATE")
                {
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["AccCode"], txtAccCode.Text.Trim());
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["AccName"], txtAccName.Text);
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Narration"], txtNarration.Text);
                    if (txtDrCr.Text.ToUpper() == "DR")
                    {
                        InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Debit"], Convert.ToDecimal(txtAmount.Text));
                    }
                    else
                    {
                        InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Debit"], Convert.ToDecimal("0"));
                    }
                    if (txtDrCr.Text.ToUpper() == "CR")
                    {
                        InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Credit"], Convert.ToDecimal(txtAmount.Text));
                    }
                    else
                    {
                        InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["Credit"], Convert.ToDecimal("0"));
                    }
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["CrDr"], txtDrCr.Text);
                    InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["VutChequeNo"], txtChqNo.Text);
                    if (txtChqDate.Text.Length > 0)
                    {
                        InfoGridView.SetRowCellValue(rowindex, InfoGridView.Columns["VutChequeDate"], Convert.ToDateTime(txtChqDate.Text));
                    }
                    InfoGridView.RefreshData();
                    BtnUndo.PerformClick();
                }
            }
        }