Beispiel #1
0
 private void btnPurcVchList_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
 {
     Transaction.List.PurchaseVouchersList frmPurcVchList = new Transaction.List.PurchaseVouchersList();
     frmPurcVchList.StartPosition = FormStartPosition.CenterParent;
     frmPurcVchList.ShowDialog();
     FillPurchaseVoucherInfo();
 }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isDelete = objPurcBL.DeletePurchaseVoucher(PurcId);

            if (isDelete)
            {
                MessageBox.Show("Delete Successfully!");
                PurcId = 0;
                ClearControls();
                Transaction.List.PurchaseVouchersList frmPurcVchList = new Transaction.List.PurchaseVouchersList();
                frmPurcVchList.StartPosition = FormStartPosition.CenterParent;
                frmPurcVchList.ShowDialog();
                FillPurchaseVoucherInfo();
            }
        }
Beispiel #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            PurchaseVoucherModel objPurcVch = new PurchaseVoucherModel();

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

            objPurcVch.VoucherType   = cbxVoucherType.Text.Trim();
            objPurcVch.PurcDate      = Convert.ToDateTime(dtDate.Text);
            objPurcVch.Terms         = cbxTerms.SelectedItem.ToString();
            objPurcVch.VoucherNumber = Convert.ToInt64(tbxVoucherNumber.Text.Trim() == string.Empty ? "0" : tbxVoucherNumber.Text.Trim());
            objPurcVch.BillNo        = Convert.ToInt64(tbxBillNo.Text.Trim() == string.Empty ? "0" : tbxBillNo.Text.Trim());
            objPurcVch.LedgerId      = objAccBL.GetLedgerIdByAccountName(cbxParty.Text.Trim());
            objPurcVch.PurcType      = cbxPurcType.Text.Trim() == null ? string.Empty : cbxPurcType.Text.Trim();
            objPurcVch.MatCentre     = cbxMatcenter.Text.Trim() == null?string.Empty : cbxMatcenter.Text.Trim();
            objPurcVch.Narration     = tbxNarration.Text.Trim() == null ? string.Empty : tbxNarration.Text.Trim();

            objPurcVch.TotalQty         = Convert.ToDecimal(colQty.SummaryItem.SummaryValue);
            objPurcVch.TotalFree        = Convert.ToDecimal(colFree.SummaryItem.SummaryValue);
            objPurcVch.TotalBasicAmount = Convert.ToDecimal(colBasicAmt.SummaryItem.SummaryValue);
            objPurcVch.TotalDisAmount   = Convert.ToDecimal(colDisAmt.SummaryItem.SummaryValue);
            objPurcVch.TotalTaxAmount   = Convert.ToDecimal(colTaxAmt.SummaryItem.SummaryValue);
            objPurcVch.TotalAmount      = Convert.ToDecimal(colItemAmount.SummaryItem.SummaryValue);
            objPurcVch.BSTotalAmount    = Convert.ToDecimal(colBSAmt.SummaryItem.SummaryValue);

            //Items Details
            Item_VoucherModel        objPurcItem;
            List <Item_VoucherModel> lstPurcItems = new List <Item_VoucherModel>();

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

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

                lstPurcItems.Add(objPurcItem);
            }

            objPurcVch.Item_Voucher = lstPurcItems;
            //Bill Sundry Details
            BillSundry_VoucherModel        objPurcBS;
            List <BillSundry_VoucherModel> lstPurcBS = new List <BillSundry_VoucherModel>();

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

                objPurcBS            = new BillSundry_VoucherModel();
                objPurcBS.BS_Id      = objBSBL.GetBSIdByBSName(row["BillSundry"].ToString() == null ? string.Empty : row["BillSundry"].ToString());
                objPurcBS.Percentage = Convert.ToDecimal(row["Percentage"].ToString() == string.Empty ? "0.00" : row["Percentage"].ToString());
                objPurcBS.Extra      = row["Extra"].ToString() == null ? string.Empty : row["Extra"].ToString();
                objPurcBS.Amount     = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                objPurcBS.BSId       = Convert.ToInt64(row["BSID"].ToString() == string.Empty ? "0" : row["BSID"].ToString());
                objPurcBS.ParentId   = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());
                lstPurcBS.Add(objPurcBS);
            }
            objPurcVch.BillSundry_Voucher = lstPurcBS;
            objPurcVch.Trans_Purc_Id      = PurcId;
            bool isSuccess = objPurcBL.UpdatePurchaseVoucher(objPurcVch);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                PurcId = 0;
                ClearControls();
                Transaction.List.PurchaseVouchersList frmPurcVchList = new Transaction.List.PurchaseVouchersList();
                frmPurcVchList.StartPosition = FormStartPosition.CenterParent;
                frmPurcVchList.ShowDialog();
                FillPurchaseVoucherInfo();
            }
        }