コード例 #1
0
 public ActionResult sync_driver()
 {
     foreach (Context.Driver dbitem in RepoDriver.FindAll())
     {
         if (Repoptnr_mstr.FindByPK(dbitem.Id + 7000000) == null)
         {
             Repoptnr_mstr.saveDriver(dbitem);
         }
     }
     return(RedirectToAction("Index"));
 }
コード例 #2
0
        public JsonResult SaveDp(Context.SalesOrderOncallDp model)
        {
            Context.SalesOrder dbitem = RepoSalesOrder.FindByOnCall(model.SalesOrderOnCallId);
            if (model.Id == 0)
            {
                dbitem.SalesOrderOncall.SalesOrderOncallDp.Add(model);
                var query = "INSERT INTO \"dbo\".\"SalesOrderOncallDp\" (\"SalesOrderOnCallId\", \"Tanggal\", \"Penerima\", \"Jenis\", \"RekeningId\", \"Jumlah\") VALUES (" + model.SalesOrderOnCallId +
                            ", " + model.Tanggal + ", " + model.Penerima + ", " + model.Jenis + ", " + model.RekeningId + ", " + model.Jumlah + ");";
                RepoAuditrail.SetAuditTrail(query, "Input DP", "List Order", UserPrincipal.id);
            }
            else
            {
                Context.SalesOrderOncallDp dbdp = dbitem.SalesOrderOncall.SalesOrderOncallDp.Where(d => d.Id == model.Id).FirstOrDefault();
                dbdp.Tanggal    = model.Tanggal;
                dbdp.Penerima   = model.Penerima;
                dbdp.RekeningId = model.RekeningId;
                dbdp.Jenis      = model.Jenis;
                dbdp.Jumlah     = model.Jumlah;
                var query = "UPDATE \"dbo\".\"SalesOrderOncallDp\" SET \"Tanggal\" = " + dbdp.Tanggal + ", \"Penerima\" = " + dbdp.Penerima + ", \"Jenis\" = \" = " + dbdp.Jenis +
                            ", \"RekeningId\" = " + dbdp.RekeningId + "\"Jumlah\" = " + dbdp.Jumlah + " WHERE \"Id\" = " + dbdp.Id + ";";
                RepoAuditrail.SetAuditTrail(query, "Input DP", "List Order", UserPrincipal.id);
            }

            RepoSalesOrder.save(dbitem);
            //lebah dieu sync ERPna
            Context.ERPConfig erpConfig = RepoERPConfig.FindByFrist();
            string            code      = "DP-" + (dbitem.SalesOrderOncallId.HasValue ? dbitem.SalesOrderOncall.SONumber : dbitem.SalesOrderProsesKonsolidasiId.HasValue ? dbitem.SalesOrderProsesKonsolidasi.SONumber : dbitem.SalesOrderPickupId.HasValue ? dbitem.SalesOrderPickup.SONumber : dbitem.SalesOrderKontrak.SONumber);

            //Jurnal
            Repoglt_det.saveFromAc(1, code, model.Jumlah, 0, Repoac_mstr.FindByPk(erpConfig.IdCashCredit)); //Cash
            Repoglt_det.saveFromAc(2, code, 0, model.Jumlah, Repoac_mstr.FindByPk(erpConfig.IdDP));         //Uang Di Muka
            //Tambah Saldo Customer
            Context.ptnr_mstr dbptnr = Repoptnr_mstr.FindByPK(dbitem.Id);

            ResponeModel response = new ResponeModel(true);

            return(Json(response));
        }