示例#1
0
        private void btnSaleVchList_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Transaction.List.SalesVouchersList frmSaleVchList = new Transaction.List.SalesVouchersList();
            frmSaleVchList.StartPosition = FormStartPosition.CenterParent;

            frmSaleVchList.ShowDialog();
            FillSalesVoucherInfo();
        }
示例#2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isDelete = objSVBL.DeleteSalesVoucher(SalesId);

            if (isDelete)
            {
                MessageBox.Show("Delete Successfully!");
                SalesId = 0;
                ClearControls();
                Transaction.List.SalesVouchersList frmSaleVchList = new Transaction.List.SalesVouchersList();
                frmSaleVchList.StartPosition = FormStartPosition.CenterParent;
                frmSaleVchList.ShowDialog();
                FillSalesVoucherInfo();
            }
        }
示例#3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            TransSalesModel objSaleVch = new TransSalesModel();

            if (tbxVoucherNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }

            objSaleVch.VoucherType      = tbxVoucherType.Text.Trim();
            objSaleVch.SaleDate         = Convert.ToDateTime(dtDate.Text);
            objSaleVch.Terms            = cbxTerms.SelectedItem.ToString();
            objSaleVch.VoucherNumber    = Convert.ToInt64(tbxVoucherNumber.Text.Trim() == string.Empty ? "0" : tbxVoucherNumber.Text.Trim());
            objSaleVch.BillNo           = Convert.ToInt64(tbxBillNo.Text.Trim() == string.Empty ? "0" : tbxBillNo.Text.Trim());
            objSaleVch.LedgerId         = objAccBL.GetLedgerIdByAccountName(tbxParty.Text.Trim());
            objSaleVch.SalesType        = tbxSaleType.Text.Trim();
            objSaleVch.MatCentre        = tbxMatcenter.Text.Trim() == null ? string.Empty : tbxMatcenter.Text.Trim();
            objSaleVch.PriceList        = cbxPriceList.Text.Trim() == null ? string.Empty : cbxPriceList.Text.Trim();
            objSaleVch.Narration        = tbxNarration.Text.Trim() == null ? string.Empty : tbxNarration.Text.Trim();
            objSaleVch.TotalAmount      = Convert.ToDecimal(Amount.SummaryItem.SummaryValue);
            objSaleVch.TotalFree        = Convert.ToDecimal(colFree.SummaryItem.SummaryValue);
            objSaleVch.TotalBasicAmount = Convert.ToDecimal(colBasicAmt.SummaryItem.SummaryValue);
            objSaleVch.TotalDisAmount   = Convert.ToDecimal(colDisAmt.SummaryItem.SummaryValue);
            objSaleVch.TotalTaxAmount   = Convert.ToDecimal(colTaxAmont.SummaryItem.SummaryValue);
            objSaleVch.TotalQty         = Convert.ToDecimal(Qty.SummaryItem.SummaryValue);
            objSaleVch.BSTotalAmount    = Convert.ToDecimal(BSAmount.SummaryItem.SummaryValue);

            //Items Details
            Item_VoucherModel        objSaleItem;
            List <Item_VoucherModel> lstSaleItems = new List <Item_VoucherModel>();

            for (int i = 0; i < dvgItemDetails.DataRowCount; i++)
            {
                DataRow row = dvgItemDetails.GetDataRow(i);

                objSaleItem                    = new Item_VoucherModel();
                objSaleItem.ITM_Id             = objIMBL.GetItemIdByItemName(row["Item"].ToString() == null ? string.Empty : row["Item"].ToString());
                objSaleItem.Qty                = Convert.ToDecimal(row["Qty"].ToString() == string.Empty ? "0.00" : row["Qty"]);
                objSaleItem.LedgerId           = objAccBL.GetLedgerIdByAccountName(row["Particulars"].ToString() == null ? string.Empty : row["Particulars"].ToString());
                objSaleItem.Unit               = row["Unit"].ToString() == null ? string.Empty : row["Unit"].ToString();
                objSaleItem.Per                = row["Per"].ToString() == null ? string.Empty : row["Per"].ToString();
                objSaleItem.Price              = Convert.ToDecimal(row["Price"].ToString() == string.Empty ? "0.00" : row["Price"].ToString());
                objSaleItem.Batch              = row["Batch"].ToString() == null ? string.Empty : row["Batch"].ToString();
                objSaleItem.Free               = Convert.ToDecimal(row["Free"].ToString() == string.Empty ? "0.00" : row["Free"].ToString());
                objSaleItem.BasicAmt           = Convert.ToDecimal(row["BasicAmt"].ToString() == string.Empty ? "0.00" : row["BasicAmt"].ToString());
                objSaleItem.DiscountPercentage = Convert.ToDecimal(row["DiscountPercentage"].ToString() == string.Empty ? "0.00" : row["DiscountPercentage"].ToString());
                objSaleItem.DiscountAmount     = Convert.ToDecimal(row["DiscountAmount"].ToString() == string.Empty ? "0.00" : row["DiscountAmount"].ToString());
                objSaleItem.TaxAmount          = Convert.ToDecimal(row["TaxAmount"].ToString() == string.Empty ? "0.00" : row["TaxAmount"].ToString());
                objSaleItem.Amount             = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                objSaleItem.Item_ID            = Convert.ToInt64(row["Item_ID"].ToString() == string.Empty ? "0" : row["Item_ID"].ToString());
                objSaleItem.ParentId           = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());

                lstSaleItems.Add(objSaleItem);
            }
            objSaleVch.SalesItem_Voucher = lstSaleItems;
            //Bill Sundry Details
            BillSundry_VoucherModel        objSaleBS;
            List <BillSundry_VoucherModel> lstSaleBS = new List <BillSundry_VoucherModel>();

            for (int i = 0; i < dvgBsDetails.DataRowCount; i++)
            {
                DataRow row = dvgBsDetails.GetDataRow(i);

                objSaleBS            = new BillSundry_VoucherModel();
                objSaleBS.BS_Id      = objBSBL.GetBSIdByBSName(row["BillSundry"].ToString() == null ? string.Empty : row["BillSundry"].ToString());
                objSaleBS.Percentage = Convert.ToDecimal(row["Percentage"].ToString() == string.Empty ? "0.00" : row["Percentage"].ToString());
                objSaleBS.Extra      = row["Extra"].ToString() == null ? string.Empty : row["Extra"].ToString();
                objSaleBS.Amount     = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                objSaleBS.BSId       = Convert.ToInt64(row["BSId"].ToString() == string.Empty ? "0" : row["BSId"].ToString());
                objSaleBS.ParentId   = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());
                lstSaleBS.Add(objSaleBS);
            }
            objSaleVch.SalesBillSundry_Voucher = lstSaleBS;
            objSaleVch.Trans_Sales_Id          = SalesId;
            bool isSuccess = objSVBL.UpdateSalesVoucherMaster(objSaleVch);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                SalesId = 0;
                ClearControls();
                Transaction.List.SalesVouchersList frmSaleVchList = new Transaction.List.SalesVouchersList();
                frmSaleVchList.StartPosition = FormStartPosition.CenterParent;
                frmSaleVchList.ShowDialog();
                FillSalesVoucherInfo();
            }
        }