Esempio n. 1
0
 private void btnPurcRetList_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
 {
     Transaction.List.PurchaseReturnVouchersList frmPurcRetList = new Transaction.List.PurchaseReturnVouchersList();
     frmPurcRetList.StartPosition = FormStartPosition.CenterParent;
     frmPurcRetList.ShowDialog();
     FillPurchaseReturnInfo();
 }
Esempio n. 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isDelete = objPurcBL.DeletePurchaseReturn(PurcRetId);

            if (isDelete)
            {
                MessageBox.Show("Delete Successfully!");
                PurcRetId = 0;
                ClearControls();
                Transaction.List.PurchaseReturnVouchersList frmPurcRetList = new Transaction.List.PurchaseReturnVouchersList();
                frmPurcRetList.StartPosition = FormStartPosition.CenterParent;
                frmPurcRetList.ShowDialog();
                FillPurchaseReturnInfo();
            }
        }
Esempio n. 3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            PurchaseReturnVoucherModel objPurcRet = new PurchaseReturnVoucherModel();

            if (tbxVoucherNumber.Text.Trim() == "")
            {
                MessageBox.Show("Voucher Number Can Not Be Blank!");
                return;
            }
            objPurcRet.VoucherType   = cbxVoucherType.Text.Trim();
            objPurcRet.PR_Date       = Convert.ToDateTime(dtDate.Text);
            objPurcRet.Terms         = cbxTerms.SelectedItem.ToString();
            objPurcRet.VoucherNumber = Convert.ToInt64(tbxVoucherNumber.Text.Trim() == string.Empty ? "0" : tbxVoucherNumber.Text.Trim());
            objPurcRet.BillNo        = Convert.ToInt64(tbxBillNo.Text.Trim() == string.Empty ? "0" : tbxBillNo.Text.Trim());
            objPurcRet.LedgerId      = objAccBL.GetLedgerIdByAccountName(cbxParty.Text.Trim());
            objPurcRet.PurchaseType  = cbxPurcRetType.Text.Trim() == null ? string.Empty : cbxPurcRetType.Text.Trim();
            objPurcRet.MatCenter     = cbxMatcenter.Text.Trim();
            objPurcRet.Narration     = tbxNarration.Text.Trim() == null ? string.Empty : tbxNarration.Text.Trim();

            objPurcRet.TotalQty         = Convert.ToDecimal(colQty.SummaryItem.SummaryValue);
            objPurcRet.TotalFree        = Convert.ToDecimal(colFree.SummaryItem.SummaryValue);
            objPurcRet.TotalBasicAmount = Convert.ToDecimal(colBasicAmt.SummaryItem.SummaryValue);
            objPurcRet.TotalDisAmount   = Convert.ToDecimal(colDisAmt.SummaryItem.SummaryValue);
            objPurcRet.TotalTaxAmount   = Convert.ToDecimal(colTaxAmt.SummaryItem.SummaryValue);
            objPurcRet.TotalAmount      = Convert.ToDecimal(colAmount.SummaryItem.SummaryValue);
            objPurcRet.BSTotalAmount    = Convert.ToDecimal(colBSAmount.SummaryItem.SummaryValue);

            //Items Details
            Item_VoucherModel        objPurcRetItem;
            List <Item_VoucherModel> lstPurcRetItems = new List <Item_VoucherModel>();

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

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

                lstPurcRetItems.Add(objPurcRetItem);
            }

            objPurcRet.Item_Voucher = lstPurcRetItems;
            //Bill Sundry Details
            BillSundry_VoucherModel        objPurcRetBS;
            List <BillSundry_VoucherModel> lstPurcRetBS = new List <BillSundry_VoucherModel>();

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

                objPurcRetBS            = new BillSundry_VoucherModel();
                objPurcRetBS.BS_Id      = objBSBL.GetBSIdByBSName(row["BillSundry"].ToString() == null ? string.Empty : row["BillSundry"].ToString());
                objPurcRetBS.Percentage = Convert.ToDecimal(row["Percentage"].ToString() == string.Empty ? "0.00" : row["Percentage"].ToString());
                objPurcRetBS.Extra      = row["Extra"].ToString() == null ? string.Empty : row["Extra"].ToString();
                objPurcRetBS.Amount     = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                objPurcRetBS.BSId       = Convert.ToInt64(row["BSId"].ToString() == string.Empty ? "0" : row["BSId"].ToString());
                objPurcRetBS.ParentId   = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());

                lstPurcRetBS.Add(objPurcRetBS);
            }
            objPurcRet.BillSundry_Voucher = lstPurcRetBS;
            objPurcRet.PR_Id = PurcRetId;
            bool isSuccess = objPurcBL.UpdatePurchaseReturn(objPurcRet);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                PurcRetId = 0;
                ClearControls();
                Transaction.List.PurchaseReturnVouchersList frmPurcRetList = new Transaction.List.PurchaseReturnVouchersList();
                frmPurcRetList.StartPosition = FormStartPosition.CenterParent;
                frmPurcRetList.ShowDialog();
                FillPurchaseReturnInfo();
            }
        }