Exemple #1
0
 private void btnSaleRetList_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
 {
     Transaction.List.SalesReturnVouchersList frmList = new Transaction.List.SalesReturnVouchersList();
     frmList.StartPosition = FormStartPosition.CenterParent;
     frmList.ShowDialog();
     FillSalesReturnInfo();
 }
Exemple #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            bool isDelete = objSRBL.DeleteSalesReturn(SalesRetId);

            if (isDelete)
            {
                MessageBox.Show("Delete Successfully!");
                SalesRetId = 0;
                ClearControls();
                Transaction.List.SalesReturnVouchersList frmList = new Transaction.List.SalesReturnVouchersList();
                frmList.StartPosition = FormStartPosition.CenterParent;
                frmList.ShowDialog();
                FillSalesReturnInfo();
            }
        }
Exemple #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            TransSalesModel objSaleRet = new TransSalesModel();

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

            objSaleRet.VoucherType      = cbxVoucherType.Text.Trim();
            objSaleRet.SaleDate         = Convert.ToDateTime(dtDate.Text);
            objSaleRet.Terms            = cbxTerms.SelectedItem.ToString();
            objSaleRet.VoucherNumber    = Convert.ToInt64(tbxVoucherNo.Text.Trim() == string.Empty ? "0" : tbxVoucherNo.Text.Trim());
            objSaleRet.BillNo           = Convert.ToInt64(tbxBillNo.Text.Trim() == string.Empty ? "0" : tbxBillNo.Text.Trim());
            objSaleRet.LedgerId         = objAccBL.GetLedgerIdByAccountName(cbxParty.Text.Trim());
            objSaleRet.SalesType        = cbxSaleType.Text.Trim();
            objSaleRet.MatCentre        = cbxMatCenter.Text.Trim();
            objSaleRet.PriceList        = cbxPriceList.Text.Trim();
            objSaleRet.Narration        = tbxNarration.Text.Trim() == null ? string.Empty : tbxNarration.Text.Trim();
            objSaleRet.TotalAmount      = Convert.ToDecimal(colAmount.SummaryItem.SummaryValue);
            objSaleRet.TotalFree        = Convert.ToDecimal(colFree.SummaryItem.SummaryValue);
            objSaleRet.TotalBasicAmount = Convert.ToDecimal(colBasicAmt.SummaryItem.SummaryValue);
            objSaleRet.TotalDisAmount   = Convert.ToDecimal(colDisAmt.SummaryItem.SummaryValue);
            objSaleRet.TotalTaxAmount   = Convert.ToDecimal(colTaxAmont.SummaryItem.SummaryValue);
            objSaleRet.TotalQty         = Convert.ToDecimal(Qty.SummaryItem.SummaryValue);
            objSaleRet.BSTotalAmount    = Convert.ToDecimal(colBSAmount.SummaryItem.SummaryValue);

            //Items Details
            Item_VoucherModel        objSaleRetItem;
            List <Item_VoucherModel> lstSaleRetItems = new List <Item_VoucherModel>();

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

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

                objSaleRetItem.Item_ID  = Convert.ToInt64(row["Item_ID"].ToString() == string.Empty ? "0" : row["Item_ID"].ToString());
                objSaleRetItem.ParentId = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());

                lstSaleRetItems.Add(objSaleRetItem);
            }

            objSaleRet.SalesItem_Voucher = lstSaleRetItems;
            //Bill Sundry Details
            BillSundry_VoucherModel        objSaleRetBS;
            List <BillSundry_VoucherModel> lstSaleRetBS = new List <BillSundry_VoucherModel>();

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

                objSaleRetBS            = new BillSundry_VoucherModel();
                objSaleRetBS.BS_Id      = objBSBL.GetBSIdByBSName(row["BillSundry"].ToString() == null ? string.Empty : row["BillSundry"].ToString());
                objSaleRetBS.Percentage = Convert.ToDecimal(row["Percentage"].ToString() == string.Empty ? "0.00" : row["Percentage"].ToString());
                objSaleRetBS.Extra      = row["Extra"].ToString() == null ? string.Empty : row["Extra"].ToString();
                objSaleRetBS.Amount     = Convert.ToDecimal(row["Amount"].ToString() == string.Empty ? "0.00" : row["Amount"].ToString());
                objSaleRetBS.BSId       = Convert.ToInt64(row["BSId"].ToString() == string.Empty ? "0" : row["BSId"].ToString());
                objSaleRetBS.ParentId   = Convert.ToInt64(row["ParentId"].ToString() == string.Empty ? "0" : row["ParentId"].ToString());
                lstSaleRetBS.Add(objSaleRetBS);
            }
            objSaleRet.SalesBillSundry_Voucher = lstSaleRetBS;
            objSaleRet.Trans_Sales_Id          = SalesRetId;

            bool isSuccess = objSRBL.UpdateSalesReturnMaster(objSaleRet);

            if (isSuccess)
            {
                MessageBox.Show("Update Successfully!");
                SalesRetId = 0;
                ClearControls();
                Transaction.List.SalesReturnVouchersList frmList = new Transaction.List.SalesReturnVouchersList();
                frmList.StartPosition = FormStartPosition.CenterParent;
                frmList.ShowDialog();
                FillSalesReturnInfo();
            }
        }