double RecivedChequePrice() { DataTable CS = new DataTable(); if (PersonalId > 0) { CS = GS.db.Query("SELECT SUM(`mablagh`) FROM `chek` WHERE `typeCheck`='1' AND `CustumerNo`='" + PersonalId + "'"); } else { CS = GS.db.Query("SELECT SUM(`mablagh`) FROM `chek` WHERE `typeCheck`='1'"); } txtTotRecived.Text = GS.nf(CS.Rows[0][0].ToString()); return(Convert.ToDouble(CS.Rows[0][0].ToString())); }
private void calcPesonalAccountStatus() { TransactionActivity.TransactionLog TL = new TransactionActivity.TransactionLog(); //string totDueQuery = ""; string totDueQuery = TL.GetAllSell(cSC.ID).ToString();// "SELECT SUM( `ItemPrice` * `itemCount` ) AS totBuy FROM `invoicedetails`WHERE `InvoiceNo`IN (SELECT `InvoiceId`FROM `invoice` WHERE `InvoiceUserId` = '" + cSC.ID + "')AND `itemCount` != '0'"; DataTable dtcpas = GS.db.Query(totDueQuery); decimal CPI = Convert.ToDecimal(cSC.ID); txtTotBuy.Text = GS.nf(TL.CalcPersonalPriceOfBuy(CPI).ToString()); txtTotPay.Text = GS.nf((TL.CalcPersonalPriceOfCashPay(CPI) + TL.CalcPersonalPriceOfChequePay(CPI)).ToString()); //txtOldDue.Text = GS.nf(TL.CalcPersonalPriceOfOldPay(CPI).ToString()); txtOldDue.Text = GS.nf(TL.CalcPersonalPriceOfOldRemainAccount(CPI).ToString()); dgvReaminAccountList.AutoGenerateColumns = false; dgvReaminAccountList.DataSource = TL.GetOldRemainAccountList(CPI); if (dtcpas != null || txtOldDue.Text == "0") { double TotBuy = Convert.ToDouble(txtTotBuy.Text.ToString()); double TotOldDue = Convert.ToDouble(txtOldDue.Text.ToString()); double TotPay = Convert.ToDouble(txtTotPay.Text.ToString()); double TotSell = Convert.ToDouble(TL.GetAllSell(cSC.ID)); double pas = (TotBuy + TotOldDue) - TotPay - TotSell; if (pas < 0) { txtBestankar.Text = GS.nf(Convert.ToString(pas * (-1))); txtDue.Text = "0"; } else { txtBestankar.Text = "0"; txtDue.Text = GS.nf(Convert.ToString(pas)); } dgvAllInvoiceList.AutoGenerateColumns = false; dgvAllInvoiceList.DataSource = GS.db.Query("SELECT * FROM `invoice` WHERE `InvoiceUserId`='" + cSC.ID + "' AND `type`='" + Invoice.InvoiceType.sell + "'"); dgvAllInvoiceList.Refresh(); dgvPish.AutoGenerateColumns = false; dgvPish.DataSource = GS.db.Query("SELECT * FROM `invoice` WHERE `InvoiceUserId`='" + cSC.ID + "' AND `type`='" + Invoice.InvoiceType.proforma + "'"); dgvPish.Refresh(); dgvAllPay.AutoGenerateColumns = false; dgvAllPay.DataSource = GS.db.Query("SELECT * FROM `accounting` WHERE `personalId`='" + cSC.ID + "' AND `payType` ='pay'"); } else { dgvAllInvoiceList.DataSource = null; } }