Ejemplo n.º 1
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 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 InfoGrid_DoubleClick(object sender, EventArgs e)
        {
#pragma warning disable CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            var MaxRow = ((InfoGrid.KeyboardFocusView as GridView).RowCount);
#pragma warning restore CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                BtnOK.Text = "&Update";
                rowindex   = InfoGridView.FocusedRowHandle;
                var row = InfoGridView.GetDataRow(InfoGridView.FocusedRowHandle);

                txtDealerCode.Text  = row["IdDealerCode"].ToString();
                txtDealerName.Text  = row["dealerName"].ToString();
                txtPrdAsgnCode.Text = row["IdPrdAsgnCode"].ToString();
                txtProductName.Text = row["PrdName"].ToString();
                txtFor.Text         = row["IdPrdQty"].ToString();
                txtFree.Text        = row["IdPrdQtyF"].ToString();

                DtFrom.EditValue = Convert.ToDateTime(row["IdDtFrom"]);
                DtTo.EditValue   = Convert.ToDateTime(row["IdDtUpto"]);

                txtPrdCode.Text = row["IdPrdCode"].ToString();
                txtPrdAsgnCode.Focus();
            }
        }
        private void InfoGrid_DoubleClick(object sender, EventArgs e)
        {
            var MaxRow = ((InfoGrid.FocusedView as GridView).RowCount);

            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                BtnOK.Text = "&Update";
                DataRow currentrow = InfoGridView.GetDataRow(InfoGridView.FocusedRowHandle);
                TransID = currentrow["TransId"].ToString();
                DataSet ds = ProjectFunctions.GetDataSet("sp_LoadDelAddress '" + TransID + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtDelAccName.Text  = ds.Tables[0].Rows[0]["DelAccName"].ToString();
                    txtDelZipCode.Text  = ds.Tables[0].Rows[0]["DelZipCode"].ToString();
                    txtDelAddress1.Text = ds.Tables[0].Rows[0]["AccAddress1"].ToString();
                    txtDelAddress2.Text = ds.Tables[0].Rows[0]["AccAddress2"].ToString();
                    txtDelAddress3.Text = ds.Tables[0].Rows[0]["AccAddress3"].ToString();
                    txtDelCitycode.Text = ds.Tables[0].Rows[0]["CityCode"].ToString();
                    txtDelCityName.Text = ds.Tables[0].Rows[0]["CTNAME"].ToString();
                    txtDelGSTNo.Text    = ds.Tables[0].Rows[0]["AccGSTNo"].ToString();
                    txtDelAddress1.Focus();
                }
            }
        }
Ejemplo n.º 5
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.º 6
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();
                }
            }
        }
Ejemplo n.º 7
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();
            }
        }
        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");
            }
        }
Ejemplo n.º 9
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);
                }
            }
        }
        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;
            }
        }
        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.º 12
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 calculation()
        {
            BeginInvoke(new MethodInvoker(delegate
            {
                InfoGridView.PostEditor();
                InfoGridView.UpdateCurrentRow();
            }));
            txtValueOfGoods.Text  = Convert.ToDecimal(gridColumn18.SummaryItem.SummaryValue).ToString("0.00");
            txtTaxableAmount.Text = Convert.ToDecimal(gridColumn18.SummaryItem.SummaryValue).ToString("0.00");
            txtTaxAmount.Text     = Convert.ToDecimal(gridColumn19.SummaryItem.SummaryValue).ToString("0.00");
            txtSurcharge.Text     = Convert.ToDecimal(gridColumn21.SummaryItem.SummaryValue).ToString("0.00");
            txtNetAmount.Text     = (Convert.ToDecimal(txtTaxableAmount.Text) + Convert.ToDecimal(txtTaxAmount.Text) + Convert.ToDecimal(txtSurcharge.Text)).ToString("0.00");

            txtRNetAmount.Text = Math.Round(Convert.ToDecimal(txtNetAmount.Text), 2).ToString("0.00");
        }
        private void BtnDelete_Click(object sender, EventArgs e)
        {
            var MaxRow = (InfoGrid.FocusedView as GridView).RowCount;

            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                InfoGridView.DeleteRow(rowindex);
                InfoGridView.RefreshData();
                dt.AcceptChanges();
                Clear();
            }
        }
        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 BtnDelete_Click(object sender, EventArgs e)
        {
#pragma warning disable CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            var MaxRow = ((InfoGrid.KeyboardFocusView as GridView).RowCount);
#pragma warning restore CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                InfoGridView.DeleteRow(rowindex);
                InfoGridView.RefreshData();
                dt.AcceptChanges();
                clear();
            }
        }
        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.º 19
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();
                }
            }
        }
Ejemplo n.º 20
0
        private void InfoGrid_DoubleClick(object sender, EventArgs e)
        {
#pragma warning disable CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            var MaxRow = ((InfoGrid.KeyboardFocusView as GridView).RowCount);
#pragma warning restore CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                BtnOK.Text = "&Update";
                rowindex   = InfoGridView.FocusedRowHandle;
                var row = InfoGridView.GetDataRow(InfoGridView.FocusedRowHandle);
                txtPrdAsgnCode.Text = row["PrdAsgnCode"].ToString();
                txtPrdCode.Text     = row["PrdCode"].ToString();
                txtProductName.Text = row["PrdName"].ToString();

                txtQty.Text = row["Quantity"].ToString();
                txtPrdAsgnCode.Focus();
            }
        }
        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();
                }
            }
        }
        private void InfoGrid_DoubleClick(object sender, EventArgs e)
        {
#pragma warning disable CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            var MaxRow = ((InfoGrid.KeyboardFocusView as GridView).RowCount);
#pragma warning restore CS0618 // 'GridControl.KeyboardFocusView' is obsolete: 'Use the FocusedView property instead.'
            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                BtnOK.Text = "&Update";
                rowindex   = InfoGridView.FocusedRowHandle;
                var row = InfoGridView.GetDataRow(InfoGridView.FocusedRowHandle);
                txtAccCode.Text = row["AccCode"].ToString();
                txtAccName.Text = row["AccName"].ToString();
                if (Convert.ToDecimal(row["Debit"]) > Convert.ToDecimal(row["Credit"]))
                {
                    txtAmount.Text = row["Debit"].ToString();
                }
                else
                {
                    txtAmount.Text = row["Credit"].ToString();
                }

                txtNarration.Text = row["Narration"].ToString();
                txtChqNo.Text     = row["VutChequeNo"].ToString();
                if (row["VutChequeDate"].ToString().Trim().Length > 0)
                {
                    txtChqDate.EditValue = Convert.ToDateTime(row["VutChequeDate"]);
                }
                txtDrCr.Text = row["CrDr"].ToString();

                txtAccCode.Focus();
            }
        }
        private void InfoGrid_DoubleClick(object sender, EventArgs e)
        {
            // var MaxRow = ((InfoGrid.FocusedView as GridView).RowCount);
            var MaxRow = ((InfoGrid.FocusedView as GridView).RowCount);

            if (MaxRow == 0)
            {
                ProjectFunctions.SpeakError("Invalid Operation");
            }
            else
            {
                BtnOK.Text = "&Update";
                rowindex   = InfoGridView.FocusedRowHandle;
                var row = InfoGridView.GetDataRow(InfoGridView.FocusedRowHandle);
                txtProductACode.Text = row["PrdAsgnCode"].ToString();
                txtProductName.Text  = row["PrdName"].ToString();
                txtProductQty.Text   = row["Qty"].ToString();
                txtAmount.Text       = row["Amount"].ToString();
                txtProductCode.Text  = row["PrdCode"].ToString();


                txtProductACode.Focus();
            }
        }
        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;
        }
Ejemplo n.º 25
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();
                }
            }
        }
Ejemplo n.º 26
0
        private void SaveInvoice()
        {
            try

            {
                if (ValidateDataForSaving())
                {
                    using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
                    {
                        var MaxRow = ((InfoGrid.FocusedView as GridView).RowCount);

                        sqlcon.Open();
                        var sqlcom = sqlcon.CreateCommand();
                        sqlcom.Connection  = sqlcon;
                        sqlcom.CommandType = CommandType.Text;
                        try
                        {
                            if (S1 == "&Add")
                            {
                                string BillNo = string.Empty;

                                BillNo             = ProjectFunctions.GetDataSet("select isnull(max(SIMNO),0)+1 from SALEINVMAIN where SIMSERIES='AP' And SIMFNYR='" + GlobalVariables.FinancialYear + "' And UnitCode='" + GlobalVariables.CUnitID + "'").Tables[0].Rows[0][0].ToString();
                                txtApprovalNo.Text = BillNo;
                                sqlcom.CommandText = "Insert into SALEINVMAIN(SIMSYSDATE,SIMFNYR,SIMDATE,SIMNO,SIMSERIES,CustCode,SIMRemarks,SIMRETURNDATE ,UnitCode,SIMGRANDTOT,SIMApprovedBy )values(" +
                                                     "@SIMSYSDATE,@SIMFNYR,@SIMDATE,@SIMNO,@SIMSERIES,@CustCode,@SIMRemarks,@SIMRETURNDATE,@UnitCode,@SIMGRANDTOT,@SIMApprovedBy)";
                                sqlcom.Parameters.Add("@SIMSYSDATE", SqlDbType.NVarChar).Value    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                sqlcom.Parameters.Add("@SIMFNYR", SqlDbType.NVarChar).Value       = GlobalVariables.FinancialYear;
                                sqlcom.Parameters.Add("@SIMDATE", SqlDbType.NVarChar).Value       = Convert.ToDateTime(txtApprovalDate.Text).ToString("yyyy-MM-dd");
                                sqlcom.Parameters.Add("@SIMNO", SqlDbType.NVarChar).Value         = txtApprovalNo.Text;
                                sqlcom.Parameters.Add("@SIMSERIES", SqlDbType.NVarChar).Value     = "AP";
                                sqlcom.Parameters.Add("@CustCode", SqlDbType.NVarChar).Value      = txtCustCode.Text;
                                sqlcom.Parameters.Add("@SIMRemarks", SqlDbType.NVarChar).Value    = txtRemarks.Text;
                                sqlcom.Parameters.Add("@SIMRETURNDATE", SqlDbType.NVarChar).Value = Convert.ToDateTime(txtReturnedUpTo.Text).ToString("yyyy-MM-dd");
                                sqlcom.Parameters.Add("@UnitCode", SqlDbType.NVarChar).Value      = GlobalVariables.CUnitID;
                                sqlcom.Parameters.Add("@SIMGRANDTOT", SqlDbType.NVarChar).Value   = gridColumn7.SummaryItem.SummaryValue.ToString();
                                sqlcom.Parameters.Add("@SIMApprovedBy", SqlDbType.NVarChar).Value = txtApprovedBy.Text;
                                sqlcom.ExecuteNonQuery();
                                sqlcom.Parameters.Clear();
                            }
                            if (S1 == "Edit")
                            {
                                sqlcom.CommandText = "Update SALEINVMAIN Set SIMSYSDATE=@SIMSYSDATE,SIMFNYR=@SIMFNYR,SIMDATE=@SIMDATE,SIMNO=@SIMNO," +
                                                     " SIMSERIES=@SIMSERIES,CustCode=@CustCode,SIMRemarks=@SIMRemarks,SIMRETURNDATE=@SIMRETURNDATE,SIMGRANDTOT=@SIMGRANDTOT,SIMApprovedBy=@SIMApprovedBy Where SIMDATE='" + Convert.ToDateTime(ImDate).ToString("yyyy-MM-dd") + "' And SIMNO='" + ImNo + "' And SIMSERIES='" + ImSeries + "' And UnitCode='" + GlobalVariables.CUnitID + "'";

                                sqlcom.Parameters.Add("@SIMSYSDATE", SqlDbType.NVarChar).Value    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                sqlcom.Parameters.Add("@SIMFNYR", SqlDbType.NVarChar).Value       = GlobalVariables.FinancialYear;
                                sqlcom.Parameters.Add("@SIMDATE", SqlDbType.NVarChar).Value       = Convert.ToDateTime(txtApprovalDate.Text).ToString("yyyy-MM-dd");
                                sqlcom.Parameters.Add("@SIMNO", SqlDbType.NVarChar).Value         = txtApprovalNo.Text;
                                sqlcom.Parameters.Add("@SIMSERIES", SqlDbType.NVarChar).Value     = "AP";
                                sqlcom.Parameters.Add("@CustCode", SqlDbType.NVarChar).Value      = txtCustCode.Text;
                                sqlcom.Parameters.Add("@SIMRemarks", SqlDbType.NVarChar).Value    = txtRemarks.Text;
                                sqlcom.Parameters.Add("@SIMRETURNDATE", SqlDbType.NVarChar).Value = Convert.ToDateTime(txtReturnedUpTo.Text).ToString("yyyy-MM-dd");
                                sqlcom.Parameters.Add("@SIMGRANDTOT", SqlDbType.NVarChar).Value   = gridColumn7.SummaryItem.SummaryValue.ToString();
                                sqlcom.Parameters.Add("@SIMApprovedBy", SqlDbType.NVarChar).Value = txtApprovedBy.Text;
                                sqlcom.ExecuteNonQuery();
                                sqlcom.Parameters.Clear();

                                sqlcom.CommandType = System.Data.CommandType.Text;
                                sqlcom.CommandText = "update SFDET set Used='N' Where SFDBARCODE in (Select SIDBARCODE  from SALEINVDET Where SIDSERIES=@SIDSERIES And SIDNO=@SIDNO And SIDDATE=@SIDDATE And UnitCode='" + GlobalVariables.CUnitID + "') AND UnitCode='" + GlobalVariables.CUnitID + "'";
                                sqlcom.Parameters.Add("@SIDSERIES", SqlDbType.NVarChar).Value = ImSeries;
                                sqlcom.Parameters.Add("@SIDNO", SqlDbType.NVarChar).Value     = ImNo;
                                sqlcom.Parameters.Add("@SIDDATE", SqlDbType.NVarChar).Value   = Convert.ToDateTime(ImDate).ToString("yyyy-MM-dd");
                                sqlcom.ExecuteNonQuery();
                                sqlcom.Parameters.Clear();



                                sqlcom.CommandType = CommandType.Text;
                                sqlcom.CommandText = "Delete from SALEINVDET Where SIDSERIES=@SIDSERIES And SIDNO=@SIDNO And SIDDATE=@SIDDATE And UnitCode ='" + GlobalVariables.CUnitID + "'";
                                sqlcom.Parameters.Add("@SIDSERIES", SqlDbType.NVarChar).Value = ImSeries;
                                sqlcom.Parameters.Add("@SIDNO", SqlDbType.NVarChar).Value     = ImNo;
                                sqlcom.Parameters.Add("@SIDDATE", SqlDbType.NVarChar).Value   = Convert.ToDateTime(ImDate).ToString("yyyy-MM-dd");
                                sqlcom.ExecuteNonQuery();
                                sqlcom.Parameters.Clear();
                            }
                            for (var i = 0; i < MaxRow; i++)
                            {
                                sqlcom.CommandType = CommandType.Text;
                                var currentrow = InfoGridView.GetDataRow(i);
                                sqlcom.CommandText = " Insert into SALEINVDET "
                                                     + " (SIDSYSDATE,SIDFNYR,SIDDATE,SIDNO,SIDSERIES,"
                                                     + " SIDBARCODE,SIDARTNO,SIDARTID,SIDCOLID,"
                                                     + " SIDSIZID,SIDSCANQTY,SIDARTMRP,SIDARTWSP,CustCode,SIDRETURNDATE,UnitCode  )"
                                                     + " values(@SIDSYSDATE,@SIDFNYR,@SIDDATE,@SIDNO,@SIDSERIES,@SIDBARCODE,@SIDARTNO,@SIDARTID,@SIDCOLID,"
                                                     + " @SIDSIZID,@SIDSCANQTY,@SIDARTMRP,@SIDARTWSP,@CustCode,@SIDRETURNDATE,@UnitCode)";
                                sqlcom.Parameters.Add("@SIDSYSDATE", SqlDbType.NVarChar).Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                                sqlcom.Parameters.Add("@SIDFNYR", SqlDbType.NVarChar).Value    = GlobalVariables.FinancialYear;
                                sqlcom.Parameters.Add("@SIDDATE", SqlDbType.NVarChar).Value    = Convert.ToDateTime(txtApprovalDate.Text).ToString("yyyy-MM-dd");
                                sqlcom.Parameters.Add("@SIDNO", SqlDbType.NVarChar).Value      = txtApprovalNo.Text.Trim();;
                                sqlcom.Parameters.Add("@SIDSERIES", SqlDbType.NVarChar).Value  = "AP";
                                sqlcom.Parameters.Add("@SIDBARCODE", SqlDbType.NVarChar).Value = currentrow["SIDBARCODE"].ToString();
                                sqlcom.Parameters.Add("@SIDARTNO", SqlDbType.NVarChar).Value   = currentrow["SIDARTNO"].ToString();
                                sqlcom.Parameters.Add("@SIDARTID", SqlDbType.NVarChar).Value   = currentrow["SIDARTID"].ToString();
                                sqlcom.Parameters.Add("@SIDCOLID", SqlDbType.NVarChar).Value   = currentrow["SIDCOLID"].ToString();
                                sqlcom.Parameters.Add("@SIDSIZID", SqlDbType.NVarChar).Value   = currentrow["SIDSIZID"].ToString();
                                sqlcom.Parameters.Add("@SIDSCANQTY", SqlDbType.NVarChar).Value = Convert.ToDecimal(currentrow["SIDSCANQTY"]);
                                sqlcom.Parameters.Add("@SIDARTMRP", SqlDbType.NVarChar).Value  = Convert.ToDecimal(currentrow["SIDARTMRP"]);
                                sqlcom.Parameters.Add("@SIDARTWSP", SqlDbType.NVarChar).Value  = Convert.ToDecimal(currentrow["SIDARTWSP"]);

                                sqlcom.Parameters.Add("@CustCode", SqlDbType.NVarChar).Value      = txtCustCode.Text;
                                sqlcom.Parameters.Add("@SIDRETURNDATE", SqlDbType.NVarChar).Value = Convert.ToDateTime(txtReturnedUpTo.Text).ToString("yyyy-MM-dd");
                                sqlcom.Parameters.Add("@UnitCode", SqlDbType.NVarChar).Value      = GlobalVariables.CUnitID;
                                sqlcom.ExecuteNonQuery();
                                sqlcom.Parameters.Clear();

                                ProjectFunctions.GetDataSet("update SFDET set Used='Y' Where SFDBARCODE='" + currentrow["SIDBARCODE"].ToString() + "' And UnitCode='" + GlobalVariables.CUnitID + "'");
                            }


                            ProjectFunctions.SpeakError("Article Approval Saved Successfully");
                            sqlcon.Close();

                            Close();
                        }
                        catch (Exception ex)
                        {
                            XtraMessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 27
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.º 28
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 BtnSave_Click(object sender, EventArgs e)
        {
            SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
            SplashScreenManager.Default.SetWaitFormDescription("Loading Data ");

            if (ValidateData())
            {
                InfoGridView.CloseEditor();
                InfoGridView.UpdateCurrentRow();
                using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
                {
                    sqlcon.Open();
                    var sqlcom      = sqlcon.CreateCommand();
                    var transaction = sqlcon.BeginTransaction("SaveTransaction");
                    sqlcom.Connection  = sqlcon;
                    sqlcom.Transaction = transaction;
                    sqlcom.CommandType = CommandType.Text;
                    try
                    {
                        if (S1 == "&Add")
                        {
                            txtPINo.Text = GetNewInvoiceDocumentNo().PadLeft(6, '0');

                            sqlcom.CommandText = "Insert into PIMstNew(PINo,PIDate,PIStoreCode)values(@PINo,@PIDate,@PIStoreCode)";
                            sqlcom.Parameters.AddWithValue("@PINo", txtPINo.Text.Trim());
                            sqlcom.Parameters.AddWithValue("@PIDate", Convert.ToDateTime(txtPIDate.Text));
                            sqlcom.Parameters.AddWithValue("@PIStoreCode", txtStoreCode.Text.Trim());

                            sqlcom.ExecuteNonQuery();
                            sqlcom.Parameters.Clear();
                        }

                        if (S1 == "Edit")
                        {
                            sqlcom.CommandType = CommandType.Text;
                            sqlcom.CommandText = "Update PIMstNew Set PIStoreCode=@PIStoreCode Where PINo = @PINo And PIDate=@PIDate ";
                            sqlcom.Parameters.AddWithValue("@PINo", txtPINo.Text.Trim());
                            sqlcom.Parameters.AddWithValue("@PIDate", Convert.ToDateTime(txtPIDate.Text));
                            sqlcom.Parameters.AddWithValue("@PIStoreCode", txtStoreCode.Text.Trim());
                            sqlcom.Parameters.Clear();


                            sqlcom.CommandType = CommandType.Text;
                            sqlcom.CommandText = " Delete from PIDataNew Where PINo = @PINo And PIDate=@PIDate ";
                            sqlcom.Parameters.AddWithValue("@PINo", txtPINo.Text.Trim());
                            sqlcom.Parameters.AddWithValue("@PIDate", Convert.ToDateTime(txtPIDate.Text));
                            sqlcom.ExecuteNonQuery();
                            sqlcom.Parameters.Clear();
                        }


                        SplashScreenManager.Default.SetWaitFormDescription("Saving Data ");
                        //foreach (DataRow dr in dt.Rows)
                        //{
                        //    sqlcom.CommandType = CommandType.Text;


                        //    sqlcom.CommandText = " Insert into PIDataNew"
                        //                               + " (PINo,PIDate,PIQty,EANNo)"
                        //                               + " values(@PINo,@PIDate,@PIQty,@EANNo)";

                        //    sqlcom.Parameters.AddWithValue("@PINo", txtPINo.Text.Trim());
                        //    sqlcom.Parameters.AddWithValue("@PIDate", Convert.ToDateTime(txtPIDate.Text));
                        //    sqlcom.Parameters.AddWithValue("@PIQty", Convert.ToDecimal(dr["PIQty"]));
                        //    sqlcom.Parameters.AddWithValue("@EANNo", dr["EANNo"].ToString());

                        //    sqlcom.ExecuteNonQuery();
                        //    sqlcom.Parameters.Clear();
                        //}



                        DataTable dtFinal = new DataTable();
                        dtFinal.Columns.Add("PINo", typeof(string));
                        dtFinal.Columns.Add("PIDate", typeof(string));
                        dtFinal.Columns.Add("PIQty", typeof(string));
                        dtFinal.Columns.Add("EANNo", typeof(string));

                        dtFinal.Rows.Clear();
                        foreach (DataRow dr in (InfoGrid.DataSource as DataTable).Rows)
                        {
                            DataRow drRow = dtFinal.NewRow();
                            drRow["PINo"]   = txtPINo.Text.Trim();
                            drRow["PIDate"] = Convert.ToDateTime(txtPIDate.Text).ToString("yyyy-MM-dd");
                            drRow["PIQty"]  = dr["PIQty"].ToString();
                            drRow["EANNo"]  = dr["EANNo"].ToString();
                            dtFinal.Rows.Add(drRow);
                        }
                        dtFinal.AcceptChanges();
                        sqlcom.CommandType    = CommandType.StoredProcedure;
                        sqlcom.CommandText    = "sp_InsertPINew";
                        sqlcom.CommandTimeout = 600000;
                        SqlParameter param = new SqlParameter
                        {
                            ParameterName = "@PerformaInv",
                            Value         = dtFinal
                        };
                        sqlcom.Parameters.Add(param);
                        sqlcom.ExecuteNonQuery();
                        sqlcom.Parameters.Clear();



                        transaction.Commit();
                        //ProjectFunctions.SpeakError("PI Data Saved Successfully");
                        sqlcon.Close();

                        if (FromExcel == "Y")
                        {
                            //  SplashScreenManager.Default.SetWaitFormDescription("Saving PI " + i.ToString());
                            i++;


                            LoadSheet();
                            DevExpress.Spreadsheet.Workbook workbook = new DevExpress.Spreadsheet.Workbook();
                            workbook.LoadDocument(openFileDialog1.FileName);
                            DevExpress.Spreadsheet.Worksheet worksheet = workbook.Worksheets[i];
                            if (i <= workbook.Sheets.Count)
                            {
                                BtnSave_Click(null, e);
                            }
                            else
                            {
                                SplashScreenManager.CloseForm(false);
                                Close();
                            }
                        }
                        else
                        {
                            SplashScreenManager.CloseForm(false);
                        }
                        Close();
                        FromExcel = "N";
                    }
                    catch (Exception ex)
                    {
                        ProjectFunctions.SpeakError("Something Wrong. \n I am going to Roll Back." + ex.Message);
                        try
                        {
                            transaction.Rollback();
                        }
                        catch (Exception ex2)
                        {
                            ProjectFunctions.SpeakError("Something Wrong. \n Roll Back Failed." + ex2.Message);
                        }
                    }
                }
            }
        }