Exemplo n.º 1
0
        public static string SaveRevenueSales(string name, decimal cost, string code)
        {
            using (AprosysAccountingEntities db = new AprosysAccountingEntities())
            {
                var obj = db.Acc_COA.Where(x => x.PId == 101 && x.HeadAccount == 5 && x.TreeName.ToLower() == name.ToLower() && x.IsActive == true).FirstOrDefault();
                if (obj != null)
                {
                    return("Exists");
                }
                var objS = db.Acc_COA.Where(x => x.PId == 101 && x.HeadAccount == 5 && x.ServiceCode == code && x.IsActive == true).FirstOrDefault();
                if (objS != null)
                {
                    return("Code Already Exists");
                }

                var obj_COA = new ApprosysAccDB.Acc_COA();
                obj_COA.PId            = 101;
                obj_COA.HeadAccount    = 5;
                obj_COA.TreeName       = name;
                obj_COA.CoaLevel       = 2;
                obj_COA.OpeningBalance = 0;
                obj_COA.IsActive       = true;
                obj_COA.Cost           = cost;
                obj_COA.ServiceCode    = code;
                db.Acc_COA.Add(obj_COA);
                db.SaveChanges();
                return("success");
            }
        }
Exemplo n.º 2
0
 public static string SaveAdministrativeExpense(string name)
 {
     using (AprosysAccountingEntities db = new AprosysAccountingEntities())
     {
         var obj = db.Acc_COA.Where(x => x.PId == 19 && x.HeadAccount == 4 && x.TreeName.ToLower() == name.ToLower() && x.IsActive == true).FirstOrDefault();
         if (obj != null)
         {
             return("Expense Already Exists");
         }
         var obj_COA = new ApprosysAccDB.Acc_COA();
         obj_COA.PId            = 19;
         obj_COA.HeadAccount    = 4;
         obj_COA.TreeName       = name;
         obj_COA.CoaLevel       = 2;
         obj_COA.OpeningBalance = 0;
         obj_COA.IsActive       = true;
         db.Acc_COA.Add(obj_COA);
         db.SaveChanges(); return("success");
         //return "success";
     }
 }