public static void PrintNotaAction(penjualan obj) { var list = CreateReportModel(obj); HelperPrint print = new HelperPrint(); print.PrintNota(list, "TrireksaApp.Reports.Layouts.NotaComplete.rdlc", null); }
public STTCreateModel(penjualan result) { IsOld = true; if (result != null) { Actived = result.Actived; ChangeDate = result.ChangeDate; From = result.From; To = result.To; Content = result.Content; CustomerIdIsPay = result.CustomerIdIsPay; CustomerIsPay = result.CustomerIsPay; DeliveryStatus = result.DeliveryStatus; Details = result.Details; DoNumber = result.DoNumber; Etc = result.Etc; Id = result.Id; Note = result.Note; PackingCosts = result.PackingCosts; PayType = result.PayType; Pcs = result.Pcs; PortType = result.PortType; Price = result.Price; ShiperID = result.ShiperID; ReciverID = result.ReciverID; Shiper = result.Shiper; Reciver = result.Reciver; STT = result.STT; TypeOfWeight = result.TypeOfWeight; Tax = result.Tax; UpdateDate = result.UpdateDate; UserID = result.UserID; IsPaid = result.IsPaid; } }
internal async Task <bool> Update(int id, penjualan penj) { var item = await client.PutAsync <penjualan>("Put", id, penj); var data = Source.Where(O => O.Id == id).FirstOrDefault(); if (item != default(penjualan) && data != null) { data.CustomerIsPay = item.CustomerIsPay; data.Details = item.Details; data.Etc = item.Etc; data.From = item.From; data.To = item.To; data.PackingCosts = item.PackingCosts; data.PayType = item.PayType; data.PortType = item.PortType; data.Price = item.Price; data.ReciverID = item.ReciverID; data.ShiperID = item.ShiperID; data.STT = item.STT; data.Tax = item.Tax; data.Total = item.Total; data.TypeOfWeight = item.TypeOfWeight; data.UserID = item.UserID; data.Content = item.Content; data.DoNumber = item.DoNumber; data.Id = item.Id; data.ChangeDate = item.ChangeDate; data.Note = item.Note; SourceView.Refresh(); return(true); } return(false); }
public async Task <penjualan> Add(penjualan item) { var result = await client.PostAsync <penjualan>("Post", item); if (result != null) { Source.Add(result); SourceView.Refresh(); } return(result); }
public IHttpActionResult Put(int id, penjualan value) { try { return(Ok(context.Update(id, value))); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex.Message)); } }
public IHttpActionResult Post(penjualan value) { try { return(Ok(context.InsertAndGetItem(value))); } catch (Exception ex) { return(Content(HttpStatusCode.BadRequest, ex.Message)); } }
private static List <Reports.Models.NotaReportModel> CreateReportModel(penjualan obj) { var MainVM = Common.ResourcesBase.GetMainWindowViewModel(); var item = obj; var userP = ResourcesBase.UserIsLogin.Email.Split('@'); List <Reports.Models.NotaReportModel> list = new List <Reports.Models.NotaReportModel>(); var data = new Reports.Models.NotaReportModel { STT = string.Format("{0:D5}", item.STT), Content = item.Content, DoNumber = item.DoNumber, Note = item.Note, PayTypeName = item.PayType.ToString(), Pcs = item.Details.Count, PortTypeName = item.PortType.ToString(), Price = item.Price, ChangeDate = item.ChangeDate, UserName = userP[0].ToString(), Tax = item.Tax, PackingCosts = item.PackingCosts, Etc = item.Etc, }; var weight = item.Details.Sum(O => O.Weight); data.Costs = weight * item.Price; data.TaxValue = (item.Tax * data.Costs) / 100; if (item.TypeOfWeight == TypeOfWeight.Volume) { data.Volume = weight; } else { data.Weight = weight; } data.GradTotal = data.Costs + data.PackingCosts + data.Etc + data.TaxValue; var shiperTlp = string.Concat("Tlp/Hp. ", item.Shiper.Phone1, "/", item.Shiper.Phone2, "/", item.Shiper.Handphone); var recieverTlp = string.Concat("Tlp/Hp. ", item.Reciver.Phone1, "/", item.Reciver.Phone2, "/", item.Reciver.Handphone); data.Shiper = string.Concat(item.Shiper.Name, Environment.NewLine, item.Shiper.Address, Environment.NewLine, shiperTlp); var ShiperCity = MainVM.CityCollection.Source.Where(O => O.Id == item.Shiper.CityID).FirstOrDefault(); data.OriginPortCode = ShiperCity.CityCode; data.ShiperCity = ShiperCity.CityName; var ReciverCity = MainVM.CityCollection.Source.Where(O => O.Id == item.Reciver.CityID).FirstOrDefault(); data.DestinationPortCode = ReciverCity.CityCode; data.ReciverCity = ReciverCity.CityName; data.Reciver = string.Concat(item.Reciver.Name, Environment.NewLine, item.Reciver.Address, Environment.NewLine, recieverTlp); data.STTQRCode = Helper.GenerateQRCodeBitmap(item.STT.ToString(), 20); list.Add(data); return(list); }
internal void SendSMSPenjualan(penjualan item, customer shiperSelected, customer reciverSelected) { item.Reciver = reciverSelected; item.Shiper = shiperSelected; OutMessage msg = new OutMessage { Destination = shiperSelected.Handphone, MessageText = GetPenjualanFormatSMS(item) }; this.SendMessage(msg); msg = new OutMessage { Destination = reciverSelected.Handphone, MessageText = GetPenjualanFormatSMS(item) }; }
private async void GetSendedInformation(penjualan _selected) { var result = await MainVM.ManifestOutgoingCollection.ManifestsByPenjualanId(_selected.Id); STTOnManifests.Clear(); if (result != null) { foreach (var item in result) { this.STTOnManifests.Add(item); } this.ManifestView.Refresh(); } }
private async void GetThumbs(penjualan selectedItem) { var context = ResourcesBase.GetMainWindowViewModel().PenjualanCollection; var result = await context.GetPhotoByPenjualanId(selectedItem.Id); if (result != null) { foreach (var item in result) { Galeries.Add(item); } GaleriesView.Refresh(); } }
private bool CheckPortAccess(penjualan value) { using (var db = new OcphDbContext()) { var ports = db.Ports.Where(O => O.CityID == value.To && O.PortType == value.PortType).FirstOrDefault(); if (ports != null) { return(true); } else { return(false); } } }
public penjualan InsertAndGetItem(penjualan value) { var date = DateTime.Now; value.ChangeDate = date; value.UpdateDate = date; using (var db = new OcphDbContext()) { if (value.Details != null && value.Details.Count > 0) { var tr = db.BeginTransaction(); try { if (value.STT == 0) { value.STT = NewSTT(); } value.Id = db.Penjualans.InsertAndGetLastID(value); if (value.Id > 0) { foreach (var item in value.Details) { item.PenjualanId = value.Id; item.Id = db.Collies.InsertAndGetLastID(item); } tr.Commit(); } else { throw new SystemException(MessageCollection.Message(MessageType.SaveFail)); } } catch (Exception ex) { tr.Rollback(); throw new SystemException(ex.Message); } } else { throw new SystemException("Item Berang Belum ada"); } } return(value); }
public static void PrintPreviewNotaAction(penjualan obj) { var list = CreateReportModel(obj); var helperPrint = new HelperPrint(); var content = new Reports.Contents.ReportContent(helperPrint.CreateNotaDataSource(list), "TrireksaApp.Reports.Layouts.NotaComplete.rdlc", null); var dlg = new ModernWindow { Content = content, Title = "Nota", Style = (Style)App.Current.Resources["BlankWindow"], ResizeMode = System.Windows.ResizeMode.CanResizeWithGrip, WindowState = WindowState.Maximized, }; dlg.ShowDialog(); }
public PenjualanInfoVM(penjualan selectedItem) { Galeries = new List <Photo>(); GaleriesView = (CollectionView)CollectionViewSource.GetDefaultView(Galeries); this.PenjualanItem = selectedItem; STTQRCode = Helper.GenerateQRCode(selectedItem.STT.ToString(), 100); this.ManifestSource = new ObservableCollection <ModelsShared.Models.manifestoutgoing>(); this.ManifestView = (CollectionView)CollectionViewSource.GetDefaultView(ManifestSource); SetManifest(selectedItem); SetInvoice(selectedItem); GetThumbs(selectedItem); AddNewPicture = new CommandHandler { CanExecuteAction = x => true, ExecuteAction = AddNewPictureAction }; PrintPicture = new CommandHandler { CanExecuteAction = x => SelectedPhoto != null, ExecuteAction = PrintPictureAction }; DeletePicture = new CommandHandler { CanExecuteAction = x => SelectedPhoto != null, ExecuteAction = DeletePictureAction }; }
private string GetPenjualanFormatSMS(penjualan item) { return(string.Format("STT:{0:D5}, Reciver={1}, Cly={2}, Weight={3}", item.STT, item.Shiper.Name, item.Details.Count, item.Details.Sum(O => O.Weight))); }
public penjualan Update(int id, penjualan value) { var date = DateTime.Now; value.UpdateDate = date; using (var db = new OcphDbContext()) { if (value.Details != null && value.Details.Count > 0) { var tr = db.BeginTransaction(); try { var dbcolies = db.Collies.Where(O => O.PenjualanId == value.Id).ToList(); foreach (var item in value.Details) { if (item.Id > 0) { var saved = db.Collies.Update(O => new { O.CollyNumber, O.Hight, O.Long, O.Weight, O.Wide, O.TypeOfWeight }, item, O => O.Id == item.Id); if (!saved) { throw new SystemException(MessageCollection.Message(MessageType.UpdateFaild)); } } else { item.Id = db.Collies.InsertAndGetLastID(item); if (item.Id <= 0) { throw new SystemException(MessageCollection.Message(MessageType.UpdateFaild)); } } } foreach (var item in dbcolies) { var ondata = value.Details.Find(O => O.Id == item.Id); if (ondata == null) { db.Collies.Delete(O => O.Id == item.Id); } } var savedParent = db.Penjualans.Update(O => new { O.UpdateDate, O.From, O.To, O.Content, O.CustomerIdIsPay, O.DoNumber, O.Etc, O.IsPaid, O.Note, O.PackingCosts, O.PayType, O.PortType, O.Price, O.ReciverID, O.ShiperID, O.STT, O.Tax, O.TypeOfWeight, O.UserID, O.ChangeDate }, value, O => O.Id == value.Id); if (!savedParent) { throw new SystemException(MessageCollection.Message(MessageType.UpdateFaild)); } tr.Commit(); return(value); } catch (Exception ex) { tr.Rollback(); throw new SystemException(ex.Message); } } else { throw new SystemException("Item Berang Belum ada"); } } }