예제 #1
0
        private void txtLedgerName_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                dgReceivableAmt.AutoGenerateColumns = false;
                int rowNo = 1;
                _entities = new MicroAccountsEntities1();

                List <tbl_AccLedger> data = new List <tbl_AccLedger>();

                if (txtLedgerName.Text == "")
                {
                    data = _entities.tbl_AccLedger.Where(x => x.tbl_AccGroup.groupName == "Sundry Debtors").ToList();
                }
                else
                {
                    data = _entities.tbl_AccLedger.Where(x => x.tbl_AccGroup.groupName == "Sundry Debtors" && x.ledgerName.Contains(txtLedgerName.Text.ToString())).ToList();
                }


                List <LedgerDetailsVM> modelList = new List <LedgerDetailsVM>();
                decimal ttlAmt = 0;
                foreach (var item in data)
                {
                    LedgerDetailsVM model = new LedgerDetailsVM();

                    CrDrDifference crdrDiff = new CrDrDifference();
                    string         valueAmt = crdrDiff.DifferenceCrDr(Convert.ToInt32(item.Id), 0);

                    string valueAmtDR = valueAmt.Substring(0, 2);


                    if (valueAmtDR == "Dr")
                    {
                        string pAmtString = valueAmt.Substring(3);

                        model.rowNo      = rowNo;
                        model.id         = item.Id;
                        model.ledgerName = item.ledgerName.ToString();
                        model.pendingAmt = Convert.ToDecimal(amtFormat.comma(Convert.ToDecimal(pAmtString)));

                        rowNo++;
                        modelList.Add(model);

                        ttlAmt          += Convert.ToDecimal(pAmtString);
                        lblTotalAmt.Text = amtFormat.comma(ttlAmt).ToString();
                    }
                }
                dgReceivableAmt.DataSource = modelList;

                lblTotalRows.Text = modelList.Count.ToString();
            }
            catch (Exception x)
            {
            }
        }
예제 #2
0
        private void cmbLedgerCR_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbLedgerCR.SelectedValue != null && cmbLedgerCR.SelectedIndex > -1 && cmbLedgerCR.Text != "")
                {
                    long crLedgerId = Convert.ToInt32(cmbLedgerCR.SelectedValue.ToString());

                    CrDrDifference crdrDiff = new CrDrDifference();
                    string         valueAmt = crdrDiff.DifferenceCrDr(crLedgerId, passedVoucherType);

                    lblCrBal.Text = valueAmt;
                }
            }
            catch (Exception x)
            {
                //   MessageBox.Show(x.ToString());
            }
        }
예제 #3
0
        private void txtLedgerName_Leave(object sender, EventArgs e)
        {
            try
            {
                _entities = new MicroAccountsEntities1();

                if (txtLedgerName.Text != string.Empty)
                {
                    var checkLedgername = _entities.tbl_AccLedger.Where(x => x.ledgerName == txtLedgerName.Text.Trim().ToString()).FirstOrDefault();

                    if (checkLedgername == null)
                    {
                        DialogResult myResult;
                        myResult = MessageBox.Show("No such party exists. Want to create new party?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (myResult == DialogResult.OK)
                        {
                            AccountLedger ledger = new AccountLedger(0, txtLedgerName.Text.Trim().ToString());
                            ledger.ShowDialog();
                            ledgerNameAutoComplete();
                            txtLedgerName.Focus();
                        }
                        else
                        {
                            txtLedgerName.Focus();
                        }
                    }


                    decimal drLedgerId = Convert.ToDecimal(checkLedgername.Id);

                    CrDrDifference crdrDiff = new CrDrDifference();
                    string         valueAmt = crdrDiff.DifferenceCrDr(Convert.ToInt32(drLedgerId), 0);

                    lblBalance.Text = valueAmt;
                }
            }
            catch (Exception x)
            {
            }
        }
예제 #4
0
        private void cmbLedgerDR_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbLedgerDR.SelectedValue != null && cmbLedgerDR.SelectedIndex > -1 && cmbLedgerDR.Text != "")
                {
                    cmbLedgerCR.Enabled = true;
                    _entities           = new MicroAccountsEntities1();

                    bindCrCMB(cmbLedgerDR.Text);

                    decimal drLedgerId = Convert.ToDecimal(cmbLedgerDR.SelectedValue.ToString());

                    CrDrDifference crdrDiff = new CrDrDifference();
                    string         valueAmt = crdrDiff.DifferenceCrDr(Convert.ToInt32(drLedgerId), passedVoucherType);

                    lblDrBal.Text = valueAmt;
                }
            }
            catch (Exception x)
            {
                //MessageBox.Show(x.ToString());
            }
        }
예제 #5
0
        private void showAvailData()
        {
            clear();
            clearDetails();

            btnCreate.Text = "Update";
            _entities      = new MicroAccountsEntities1();

            var data = _entities.tbl_SalesMaster.Where(x => x.sId == passedSid).FirstOrDefault();

            txtBillNo.Text       = data.billNo;
            dateTimePicker1.Text = data.date.ToString();
            txtLedgerName.Text   = _entities.tbl_AccLedger.Where(x => x.Id == data.ledgerId).FirstOrDefault().ledgerName;

            txtTotalKarat.Text  = data.totalKarat.ToString();
            txtTotalMaking.Text = amtFormat.comma(data.totalMaking).ToString();
            txtTotalRate.Text   = amtFormat.comma(data.totalAmt).ToString();
            txtTotalWeight.Text = data.totalWeight.ToString();

            ttlWeight = Convert.ToDecimal(txtTotalWeight.Text) * 1000;
            ttlKarat  = Convert.ToDecimal(txtTotalKarat.Text);
            ttlRate   = Convert.ToDecimal(txtTotalRate.Text);
            ttlMaking = Convert.ToDecimal(txtTotalMaking.Text);

            txtAmtInWords.Text = "";
            ConvertNoToWord convertToWord = new ConvertNoToWord();

            //int totalRate = Convert.ToInt32(txtTotalRate.Text);
            txtAmtInWords.Text = convertToWord.ConvertNumbertoWords(Convert.ToInt32(data.totalAmt)).ToLower();

            _entities = new MicroAccountsEntities1();

            var salesDetailsData = _entities.tbl_SalesDetails.Where(x => x.salesId == passedSid).ToList();

            id = 1;
            foreach (var item in salesDetailsData)
            {
                var itemCode = _entities.tbl_ItemMaster.Where(x => x.id == item.productId).FirstOrDefault().itemCode;

                dgSalesItem.Rows.Add(
                    id.ToString(),
                    itemCode,
                    item.qty,
                    item.weight,
                    item.unit,
                    item.karat,
                    item.kRate,
                    item.making,
                    item.rate);

                id = id + 1;
            }

            var checkLedgername = _entities.tbl_AccLedger.Where(x => x.ledgerName == txtLedgerName.Text.Trim().ToString()).FirstOrDefault();

            decimal drLedgerId = Convert.ToDecimal(checkLedgername.Id);

            CrDrDifference crdrDiff = new CrDrDifference();
            string         valueAmt = crdrDiff.DifferenceCrDr(Convert.ToInt32(drLedgerId), 0);

            lblBalance.Text = valueAmt;
        }