private void addSalesMaster() { _entities = new MicroAccountsEntities1(); var data = _entities.tbl_SalesMaster.Where(x => x.sId == passedId).ToList(); List <SalesMasterVM> listVm = new List <SalesMasterVM>(); List <LedgerDetailsVM> LedgerlistVm = new List <LedgerDetailsVM>(); foreach (var item in data) { SalesMasterVM vm = new SalesMasterVM(); vm.date = Convert.ToDateTime(item.date).Date.ToString("dd-MM-yyyy"); vm.ledgerName = _entities.tbl_AccLedger.Where(x => x.Id == item.ledgerId).FirstOrDefault().ledgerName.Trim(); vm.ledgerId = item.ledgerId; vm.sId = item.sId; vm.billNo = item.billNo; vm.remarks = item.remarks; vm.totalMaking = item.totalMaking; vm.totalKarat = item.totalKarat; vm.totalWeight = item.totalWeight; vm.unit = item.unit; AmtFormatting amtFormat = new AmtFormatting(); vm.totalAmt = item.totalAmt; ConvertNoToWord toWord = new ConvertNoToWord(); vm.amtinWord = toWord.ConvertNumbertoWords(Convert.ToInt32(item.totalAmt)); listVm.Add(vm); LedgerDetailsVM ll = new LedgerDetailsVM(); ll.contact = _entities.tbl_LedgerDetails.Where(x => x.ledgerId == item.ledgerId).FirstOrDefault().contact; ll.address = _entities.tbl_LedgerDetails.Where(x => x.ledgerId == item.ledgerId).FirstOrDefault().address.Trim(); LedgerlistVm.Add(ll); } ReportDataSource datasource = new ReportDataSource("DataSet1", listVm); this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet3", LedgerlistVm); this.reportViewer1.LocalReport.DataSources.Add(datasource); }
private void cmbKarat_SelectedIndexChanged(object sender, EventArgs e) { try { _entities = new MicroAccountsEntities1(); var dateToday = DateTime.Now.Date; if (cmbKarat.SelectedIndex == 0) { var rate = _entities.DailyRates.Where(x => x.date == dateToday).FirstOrDefault().eighteenC; amtFormat = new AmtFormatting(); txtKRate.Text = amtFormat.comma(rate); } else if (cmbKarat.SelectedIndex == 1) { var rate = _entities.DailyRates.Where(x => x.date == dateToday).FirstOrDefault().twentyTwoC; amtFormat = new AmtFormatting(); txtKRate.Text = amtFormat.comma(rate); } else if (cmbKarat.SelectedIndex == 2) { var rate = _entities.DailyRates.Where(x => x.date == dateToday).FirstOrDefault().twentyThreeC; amtFormat = new AmtFormatting(); txtKRate.Text = amtFormat.comma(rate); } else if (cmbKarat.SelectedIndex == 3) { var rate = _entities.DailyRates.Where(x => x.date == dateToday).FirstOrDefault().fineGold; amtFormat = new AmtFormatting(); txtKRate.Text = amtFormat.comma(rate); } else if (cmbKarat.SelectedIndex == 4) { var rate = _entities.DailyRates.Where(x => x.date == dateToday).FirstOrDefault().hallmark; amtFormat = new AmtFormatting(); txtKRate.Text = amtFormat.comma(rate); } } catch (Exception x) { } }
private void PaymentReceiptBillReference_Load(object sender, EventArgs e) { try { // if (passedVoucherType == 1) { //payment mate _entities = new MicroAccountsEntities1(); var isDataPresent = _entities.tbl_EntryDetails.Where(x => x.voucherRefNo == this.passedVoucherNo).FirstOrDefault(); if (isDataPresent == null) { cmbBillRef.SelectedIndex = -1; cmbBInd(idPassedToCmbArray); } else { AmtFormatting amtFormat = new AmtFormatting(); comestoUpdate = true; cmbRefType.SelectedIndex = 1; idPassedToCmbArray = new List <long?>(); idPassedToCmbArray.Add(0); cmbBInd(idPassedToCmbArray); //calling combobox method btnCreate.Text = "Update"; _entities = new MicroAccountsEntities1(); var data = _entities.tbl_EntryDetails.Where(x => x.voucherRefNo == this.passedVoucherNo).ToList(); int id = 1; idPassedToCmbArray = new List <long?>(); foreach (var item in data) { idPassedToCmbArray.Add(item.purchaseSalesIds); // paymentDetailsTotalAmt += item.amtPaid; var billNo = _entities.tbl_PurchaseMaster.Where(x => x.pId == item.purchaseSalesIds).FirstOrDefault(); dgBillRef.Rows.Add( item.purchaseSalesIds, "#", billNo.refNo, billNo.date, amtFormat.comma(item.amtPaid), item.pDetailsId ); id = id + 1; } datagridId = data.Count; lblRows.Text = datagridId.ToString() + " Rows"; } } //else { //receipt mate } } catch (Exception x) { MessageBox.Show("Something went wrong. Contact your system administrator"); } }