public int getuserreceiveablessum(int userid)
        {
            financeaccountrepo financeaccountrepo = new financeaccountrepo();
            financeaccount     financeaccount     = financeaccountrepo.getonebyname("account receivable");
            string             sql = "select sum(amount) from financetransaction where fk_user_targetto_in_financetransaction=" + userid + " and fk_financeaccount_in_financetransaction=" + financeaccount.id + ";";

            using (var connection = new MySqlConnection(conn))
            {
                var res = connection.ExecuteScalar <int>(sql);
                return(res);
            }
        }
        public List <dapper.financetransactionextended> getmanybyselfnameandfinanceaccountname(string selfname, string financeaccountname)
        {
            financeaccountrepo financeaccountrepo = new financeaccountrepo();
            financeaccount     financeaccount     = financeaccountrepo.getonebyname(financeaccountname);

            string sql = "select " + joinselect + " where t1.name='" + selfname + "' and t1.fk_financeaccount_in_financetransaction=" + financeaccount.id + ";";

            using (var connection = new MySqlConnection(conn))
            {
                var res = connection.Query <dapper.financetransactionextended>(sql).ToList();
                return(res);
            }
        }
        public int getuserpayablesum(int userid)
        {
            financeaccountrepo financeaccountrepo = new financeaccountrepo();
            financeaccount     financeaccount     = financeaccountrepo.getonebyname("account payable");
            var list = new List <KeyValuePair <string, object> >();

            list.Add(new KeyValuePair <string, object>("fk_user_targetto_in_financetransaction", userid));
            list.Add(new KeyValuePair <string, object>("fk_financeaccount_in_financetransaction", financeaccount.id));
            string and = baserepo.getkeyValuestoSqlAnd(list);
            string sql = "select sum(amount) from financetransaction where " + and + ";";

            using (var connection = new MySqlConnection(conn))
            {
                var res = connection.ExecuteScalar <int>(sql);
                return(res);
            }
        }