package iade.gui;
import hibernateSwingApi.component.CTextField;
import hibernateSwingApi.hibernate.HibernateManager;
import iade.pojos.Iade;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;
import kasa.manager.KasaManager;
import satis.pojos.YapilanSatis;
import satisBilgi.pojos.OdemeBilgileri;
import satisBilgi.pojos.UrunSatis;
import service.AutoClosingMessageDialog;
import service.PSAUtil;
import urun.pojos.UrunStok;
import control.DecimalValue;
public class PSAUrunParaIadeEkrani extends JFrame {
private static final long serialVersionUID = 1L;
private static PSAUrunParaIadeEkrani instance;
private JPanel contentPane;
private JPanel jPanelSatisBilgileri;
private JLabel jLabelSatisBilgileri;
private JPanel jPanelSatisBilgi;
private JLabel jLabelSatisTarih;
private JLabel jLabelSatisOdemeTuru;
private JLabel jLabelSatisTuru;
private JLabel jLabelSatisTarihBilgi;
private JLabel jLabelSatisOdemeTuruBilgi;
private JLabel jLabelSatisTuruBilgi;
private JLabel jLabelSatisKDV;
private JLabel jLabelSatisIskonto;
private JLabel jLabelSatisTutar;
private JLabel jLabelSatisKDVBilgi;
private JLabel jLabelSatisIskontoBilgi;
private JLabel jLabelSatisTutarBilgi;
private YapilanSatis satisBilgi;
private double satisTutar;
private UrunSatis urunSatisBilgi;
private JPanel jPanelUrun;
private JPanel jPanelUrunBilgileri;
private JLabel jLabelUrunBilgi;
private JButton jButtonParaIade;
private JButton jButtonGeri;
private JLabel jLabelUrunKodu;
private JLabel jLabelUrunKoduBilgi;
private JLabel jLabelUrunKDV;
private JLabel jLabelUrunKDVBilgi;
private JLabel jLabelUrunBarkod;
private JLabel jLabelUrunBarkodBilgi;
private JLabel jLabelUrunFiyat;
private JLabel jLabelUrunFiyatBilgi;
private JLabel jLabelUrunAdet;
private JLabel jLabelUrunAdetBilgi;
private JLabel jLabelIadeParaBilgi;
private CTextField cTextFieldTamKisim;
private JLabel jLabelVirgul;
private CTextField cTextFieldKurusKisim;
private JLabel jLabelTL;
private JLabel jLabelKDVTL;
private JLabel jLabelIskontoTL;
private JLabel jLabelTutarTL;
private JLabel jLabelFiyatTL;
private List<Iade> iadeBilgisiListesi = new LinkedList<>();
private JLabel jLabelPersonel;
private JLabel jLabelPersonelBilgi;
private JLabel jLabelMusteri;
private JLabel jLabelMusteriBilgi;
private JLabel jLabelSatisToplamTutar;
private JLabel jLabelSatisToplamTutarBilgi;
private JLabel jLabelToplamTutarTL;
private double toplamTutar;
private final String P_FIYAT = "Peşin Fiyatı";
private final String T_FİYAT = "Taksitli Fiyatı";
private final static String IADE_SATIS = "IS";
private JLabel jLabelKampanyaTutar;
private JLabel jLabelKampanyaTutarBilgi;
private JLabel jLabelKampanyaTutarTL;
public static PSAUrunParaIadeEkrani getInstance(YapilanSatis satis,
UrunSatis urunSatis) {
instance = new PSAUrunParaIadeEkrani(satis, urunSatis);
return instance;
}
private PSAUrunParaIadeEkrani(YapilanSatis satis, UrunSatis urunSatis) {
satisBilgi = satis;
urunSatisBilgi = urunSatis;
initialize();
}
private void initialize() {
setTitle("PSA ÜRÜN DEĞİŞİM EKRANI");
setResizable(false);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setIconImage(PSAUtil.getImageIconViaRelativePath("picture/psaIcon.png")
.getImage());
setBounds(100, 100, 796, 547);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
jPanelSatisBilgileri = new JPanel();
jPanelSatisBilgileri.setBounds(10, 11, 768, 498);
contentPane.add(jPanelSatisBilgileri);
jPanelSatisBilgileri.setLayout(null);
jLabelSatisBilgileri = new JLabel("SATIŞ BİLGİLERİ");
jLabelSatisBilgileri.setFont(new Font("Tahoma", Font.BOLD, 15));
jLabelSatisBilgileri.setBounds(10, 0, 136, 24);
jPanelSatisBilgileri.add(jLabelSatisBilgileri);
jPanelSatisBilgi = new JPanel();
jPanelSatisBilgi.setBackground(UIManager.getColor("Button.shadow"));
jPanelSatisBilgi.setBounds(10, 35, 748, 167);
jPanelSatisBilgileri.add(jPanelSatisBilgi);
jPanelSatisBilgi.setLayout(null);
jLabelSatisTarih = new JLabel();
jLabelSatisTarih.setText("Tarih");
jLabelSatisTarih.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisTarih.setBounds(10, 11, 120, 20);
jPanelSatisBilgi.add(jLabelSatisTarih);
jLabelSatisOdemeTuru = new JLabel();
jLabelSatisOdemeTuru.setText("Ödeme Türü");
jLabelSatisOdemeTuru.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisOdemeTuru.setBounds(10, 42, 120, 20);
jPanelSatisBilgi.add(jLabelSatisOdemeTuru);
jLabelSatisTuru = new JLabel();
jLabelSatisTuru.setText("Satış Türü");
jLabelSatisTuru.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisTuru.setBounds(10, 73, 120, 20);
jPanelSatisBilgi.add(jLabelSatisTuru);
jLabelSatisTarihBilgi = new JLabel("");
jLabelSatisTarihBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisTarihBilgi.setBounds(154, 11, 180, 20);
jPanelSatisBilgi.add(jLabelSatisTarihBilgi);
jLabelSatisOdemeTuruBilgi = new JLabel("");
jLabelSatisOdemeTuruBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisOdemeTuruBilgi.setBounds(154, 42, 180, 20);
jPanelSatisBilgi.add(jLabelSatisOdemeTuruBilgi);
jLabelSatisTuruBilgi = new JLabel("");
jLabelSatisTuruBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisTuruBilgi.setBounds(154, 73, 180, 20);
jPanelSatisBilgi.add(jLabelSatisTuruBilgi);
jLabelSatisKDV = new JLabel();
jLabelSatisKDV.setText("KDV Miktarı");
jLabelSatisKDV.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisKDV.setBounds(376, 42, 120, 20);
jPanelSatisBilgi.add(jLabelSatisKDV);
jLabelSatisIskonto = new JLabel();
jLabelSatisIskonto.setText("İskonto Miktarı");
jLabelSatisIskonto.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisIskonto.setBounds(376, 73, 120, 20);
jPanelSatisBilgi.add(jLabelSatisIskonto);
jLabelSatisTutar = new JLabel();
jLabelSatisTutar.setText("Ara Toplam");
jLabelSatisTutar.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisTutar.setBounds(376, 11, 120, 20);
jPanelSatisBilgi.add(jLabelSatisTutar);
jLabelSatisKDVBilgi = new JLabel("");
jLabelSatisKDVBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisKDVBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelSatisKDVBilgi.setBounds(518, 42, 94, 20);
jPanelSatisBilgi.add(jLabelSatisKDVBilgi);
jLabelSatisIskontoBilgi = new JLabel("");
jLabelSatisIskontoBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisIskontoBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelSatisIskontoBilgi.setBounds(518, 73, 94, 20);
jPanelSatisBilgi.add(jLabelSatisIskontoBilgi);
jLabelSatisTutarBilgi = new JLabel("");
jLabelSatisTutarBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisTutarBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelSatisTutarBilgi.setBounds(518, 11, 94, 20);
jPanelSatisBilgi.add(jLabelSatisTutarBilgi);
jLabelKDVTL = new JLabel();
jLabelKDVTL.setText("TL");
jLabelKDVTL.setBounds(622, 42, 21, 20);
jPanelSatisBilgi.add(jLabelKDVTL);
jLabelIskontoTL = new JLabel();
jLabelIskontoTL.setText("TL");
jLabelIskontoTL.setBounds(622, 73, 21, 20);
jPanelSatisBilgi.add(jLabelIskontoTL);
jLabelTutarTL = new JLabel();
jLabelTutarTL.setText("TL");
jLabelTutarTL.setBounds(622, 11, 21, 20);
jPanelSatisBilgi.add(jLabelTutarTL);
jLabelPersonel = new JLabel();
jLabelPersonel.setText("Personel");
jLabelPersonel.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelPersonel.setBounds(10, 104, 120, 20);
jPanelSatisBilgi.add(jLabelPersonel);
jLabelPersonelBilgi = new JLabel("-");
jLabelPersonelBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelPersonelBilgi.setBounds(154, 104, 180, 20);
jPanelSatisBilgi.add(jLabelPersonelBilgi);
jLabelMusteri = new JLabel();
jLabelMusteri.setText("Müşteri");
jLabelMusteri.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelMusteri.setBounds(10, 135, 120, 20);
jPanelSatisBilgi.add(jLabelMusteri);
jLabelMusteriBilgi = new JLabel("-");
jLabelMusteriBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelMusteriBilgi.setBounds(154, 135, 180, 20);
jPanelSatisBilgi.add(jLabelMusteriBilgi);
jLabelSatisToplamTutar = new JLabel();
jLabelSatisToplamTutar.setText("Tutar");
jLabelSatisToplamTutar.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelSatisToplamTutar.setBounds(376, 135, 120, 20);
jPanelSatisBilgi.add(jLabelSatisToplamTutar);
jLabelSatisToplamTutarBilgi = new JLabel("0.00");
jLabelSatisToplamTutarBilgi
.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelSatisToplamTutarBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelSatisToplamTutarBilgi.setBounds(518, 135, 94, 20);
jPanelSatisBilgi.add(jLabelSatisToplamTutarBilgi);
jLabelToplamTutarTL = new JLabel();
jLabelToplamTutarTL.setText("TL");
jLabelToplamTutarTL.setBounds(622, 135, 21, 20);
jPanelSatisBilgi.add(jLabelToplamTutarTL);
jLabelKampanyaTutar = new JLabel();
jLabelKampanyaTutar.setText("Kampanya Tutar");
jLabelKampanyaTutar.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelKampanyaTutar.setBounds(376, 104, 120, 20);
jPanelSatisBilgi.add(jLabelKampanyaTutar);
jLabelKampanyaTutarBilgi = new JLabel("0.00");
jLabelKampanyaTutarBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelKampanyaTutarBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelKampanyaTutarBilgi.setBounds(518, 104, 94, 20);
jPanelSatisBilgi.add(jLabelKampanyaTutarBilgi);
jLabelKampanyaTutarTL = new JLabel();
jLabelKampanyaTutarTL.setText("TL");
jLabelKampanyaTutarTL.setBounds(622, 104, 21, 20);
jPanelSatisBilgi.add(jLabelKampanyaTutarTL);
jPanelUrun = new JPanel();
jPanelUrun.setBackground(UIManager.getColor("Button.shadow"));
jPanelUrun.setBounds(10, 223, 748, 201);
jPanelSatisBilgileri.add(jPanelUrun);
jPanelUrun.setLayout(null);
jPanelUrunBilgileri = new JPanel();
jPanelUrunBilgileri.setBounds(17, 46, 714, 107);
jPanelUrun.add(jPanelUrunBilgileri);
jPanelUrunBilgileri.setLayout(null);
jLabelUrunKodu = new JLabel();
jLabelUrunKodu.setText("Ürün Kodu");
jLabelUrunKodu.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelUrunKodu.setBounds(10, 11, 120, 20);
jPanelUrunBilgileri.add(jLabelUrunKodu);
jLabelUrunKoduBilgi = new JLabel("");
jLabelUrunKoduBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelUrunKoduBilgi.setBounds(154, 11, 180, 20);
jPanelUrunBilgileri.add(jLabelUrunKoduBilgi);
jLabelUrunKDV = new JLabel();
jLabelUrunKDV.setText("KDV(%)");
jLabelUrunKDV.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelUrunKDV.setBounds(376, 11, 93, 20);
jPanelUrunBilgileri.add(jLabelUrunKDV);
jLabelUrunKDVBilgi = new JLabel("");
jLabelUrunKDVBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelUrunKDVBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelUrunKDVBilgi.setBounds(500, 11, 93, 20);
jPanelUrunBilgileri.add(jLabelUrunKDVBilgi);
jLabelUrunBarkod = new JLabel();
jLabelUrunBarkod.setText("Ürün Barkod");
jLabelUrunBarkod.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelUrunBarkod.setBounds(10, 42, 120, 20);
jPanelUrunBilgileri.add(jLabelUrunBarkod);
jLabelUrunBarkodBilgi = new JLabel((String) null);
jLabelUrunBarkodBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelUrunBarkodBilgi.setBounds(154, 42, 180, 20);
jPanelUrunBilgileri.add(jLabelUrunBarkodBilgi);
jLabelUrunFiyat = new JLabel();
jLabelUrunFiyat.setText("Peşin Fiyatı");
jLabelUrunFiyat.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelUrunFiyat.setBounds(376, 42, 93, 20);
jPanelUrunBilgileri.add(jLabelUrunFiyat);
jLabelUrunFiyatBilgi = new JLabel("");
jLabelUrunFiyatBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
jLabelUrunFiyatBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelUrunFiyatBilgi.setBounds(500, 42, 93, 20);
jPanelUrunBilgileri.add(jLabelUrunFiyatBilgi);
jLabelUrunAdet = new JLabel();
jLabelUrunAdet.setText("Adet");
jLabelUrunAdet.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelUrunAdet.setBounds(10, 73, 120, 20);
jPanelUrunBilgileri.add(jLabelUrunAdet);
jLabelUrunAdetBilgi = new JLabel((String) null);
jLabelUrunAdetBilgi.setFont(new Font("Dialog", Font.PLAIN, 13));
jLabelUrunAdetBilgi.setBounds(154, 73, 180, 20);
jPanelUrunBilgileri.add(jLabelUrunAdetBilgi);
jLabelFiyatTL = new JLabel();
jLabelFiyatTL.setText("TL");
jLabelFiyatTL.setBounds(603, 42, 21, 20);
jPanelUrunBilgileri.add(jLabelFiyatTL);
jLabelUrunBilgi = new JLabel("ÜRÜN BİLGİLERİ");
jLabelUrunBilgi.setFont(new Font("Tahoma", Font.BOLD, 15));
jLabelUrunBilgi.setBounds(17, 11, 160, 24);
jPanelUrun.add(jLabelUrunBilgi);
jLabelIadeParaBilgi = new JLabel();
jLabelIadeParaBilgi.setText("Müşteriye Ödenecek Tutar");
jLabelIadeParaBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));
jLabelIadeParaBilgi.setBounds(352, 171, 223, 20);
jPanelUrun.add(jLabelIadeParaBilgi);
cTextFieldTamKisim = new CTextField(7);
cTextFieldTamKisim.setFont(new Font("Tahoma", Font.PLAIN, 13));
cTextFieldTamKisim.setText("0");
cTextFieldTamKisim.setHorizontalAlignment(SwingConstants.RIGHT);
cTextFieldTamKisim.setBounds(579, 171, 86, 20);
cTextFieldTamKisim.setAsOnlyNumberTextField();
jPanelUrun.add(cTextFieldTamKisim);
jLabelVirgul = new JLabel();
jLabelVirgul.setText(",");
jLabelVirgul.setBounds(668, 171, 9, 29);
jPanelUrun.add(jLabelVirgul);
cTextFieldKurusKisim = new CTextField(2);
cTextFieldKurusKisim.setFont(new Font("Tahoma", Font.PLAIN, 13));
cTextFieldKurusKisim.setText("00");
cTextFieldKurusKisim.setBounds(675, 171, 33, 20);
cTextFieldKurusKisim.setAsOnlyNumberTextField();
jPanelUrun.add(cTextFieldKurusKisim);
jLabelTL = new JLabel();
jLabelTL.setText("TL");
jLabelTL.setBounds(710, 176, 21, 14);
jPanelUrun.add(jLabelTL);
jButtonParaIade = new JButton();
jButtonParaIade.setText("İADE AL");
jButtonParaIade.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/pesin.png"));
jButtonParaIade.setFont(new Font("Tahoma", Font.BOLD, 15));
jButtonParaIade.setBounds(406, 435, 317, 50);
jPanelSatisBilgileri.add(jButtonParaIade);
jButtonGeri = new JButton();
jButtonGeri.setText("İPTAL");
jButtonGeri.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/geriButonu.png"));
jButtonGeri.setFont(new Font("Tahoma", Font.BOLD, 15));
jButtonGeri.setBounds(40, 435, 317, 50);
jPanelSatisBilgileri.add(jButtonGeri);
fillSatisInfo();
fillUrunInfo();
initListener();
}
private void initListener() {
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent arg0) {
iadeEkranSetEnable();
}
});
jButtonGeri.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
iadeEkranSetEnable();
}
});
jButtonParaIade.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
paraIadeClicked();
}
});
cTextFieldTamKisim.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (cTextFieldTamKisim.getText().equals("0")) {
cTextFieldTamKisim.setText("");
}
}
@Override
public void focusLost(FocusEvent e) {
if (cTextFieldTamKisim.getText().equals("")) {
cTextFieldTamKisim.setText("0");
}
}
});
cTextFieldKurusKisim.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (cTextFieldKurusKisim.getText().equals("00")) {
cTextFieldKurusKisim.setText("");
}
}
@Override
public void focusLost(FocusEvent e) {
if (cTextFieldKurusKisim.getText().equals("")) {
cTextFieldKurusKisim.setText("00");
}
if (cTextFieldKurusKisim.getText().length() == 1) {
String kurusKisim = cTextFieldKurusKisim.getText() + "0";
cTextFieldKurusKisim.setText(kurusKisim);
}
}
});
}
protected void paraIadeClicked() {
boolean check = false;
boolean check1 = false;
satisTutar = Double.parseDouble(cTextFieldTamKisim.getText() + "."
+ cTextFieldKurusKisim.getText());
if (satisTutar == 0) {
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"İade edilecek para miktarını giriniz.", 2);
return;
}
if (toplamTutar < satisTutar) {
AutoClosingMessageDialog
.showAutoClosingMessageDialog(
"Satış tutarından daha fazla para iadesi yapılmak istenmektedir.",
2);
return;
}
if (satisBilgi.getVade() == true) {
if (urunSatisBilgi.getTaksitliSatisFiyati() < satisTutar) {
AutoClosingMessageDialog
.showAutoClosingMessageDialog(
"Ürünün taksitli fiyatından fazla para iade yapılmak istenmektedir.",
2);
return;
}
} else {
if (urunSatisBilgi.getPesinSatisFiyati() < satisTutar) {
AutoClosingMessageDialog
.showAutoClosingMessageDialog(
"Ürünün peşin fiyatından fazla para iade yapılmak istenmektedir.",
2);
return;
}
}
addUrunStok(urunSatisBilgi);
if (urunSatisBilgi.getAdet() > 1) {
urunSatisBilgi.setAdet(urunSatisBilgi.getAdet() - 1);
check = HibernateManager.getInstance().update(urunSatisBilgi);
UrunSatis urunSatis = new UrunSatis();
urunSatis = urunSatisBilgi;
urunSatis.setAdet(1);
urunSatis.setSatisDurum(IADE_SATIS);
urunSatis.setTarih(new Date());
HibernateManager.getInstance().save(urunSatis);
HibernateManager.getInstance().saveEntityObject(satisBilgi,
"satisListesi", urunSatis);
} else {
urunSatisBilgi.setSatisDurum(IADE_SATIS);
check = HibernateManager.getInstance().update(urunSatisBilgi);
}
if (check) {
Iade iadeBilgi = new Iade();
iadeBilgi.setSystemName(HibernateManager.getInstance()
.getSystemName());
iadeBilgi.setIadeUrunId(urunSatisBilgi.getId());
OdemeBilgileri odemeBilgisi = new OdemeBilgileri();
odemeBilgisi.setSystemName(HibernateManager.getInstance()
.getSystemName());
odemeBilgisi.setKrediKartTutar(0.00);
odemeBilgisi.setNakitTutar(-1 * satisTutar);
iadeBilgi.setOdemeBilgisiId(odemeBilgisi);
iadeBilgi.setTutar(-1 * satisTutar);
if (satisIadeListesiControl()) {
HibernateManager.getInstance().saveEntityObject(satisBilgi,
"iadeBilgisi", iadeBilgi);
} else {
iadeBilgisiListesi.add(iadeBilgi);
satisBilgi.setIadeBilgisi(iadeBilgisiListesi);
}
}
check1 = HibernateManager.getInstance().update(satisBilgi);
if (check || check1) {
KasaManager.addIadeHareket(satisBilgi, -1 * satisTutar);
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Ürün parası iade edilmiştir.", 2);
iadeEkranSetEnable();
PSAIadeEkrani.tabloDoldur();
}
}
@SuppressWarnings("unchecked")
private boolean satisIadeListesiControl() {
List<Iade> iadeListesi = (List<Iade>) HibernateManager.getInstance()
.getEntitysList(satisBilgi, "iadeBilgisi");
if (iadeListesi.size() > 0) {
return true;
}
return false;
}
private static void addUrunStok(UrunSatis urunSatisBilgi) {
UrunStok us = (UrunStok) HibernateManager.getInstance()
.getObjectWithUniqueColumn(UrunStok.class, "barkod",
urunSatisBilgi.getBarkod());
if (us != null) {
us.setAdet(us.getAdet() + 1);
HibernateManager.getInstance().update(us);
} else {
us = new UrunStok(urunSatisBilgi);
HibernateManager.getInstance().save(us);
}
}
protected static void iadeEkranSetEnable() {
PSAIadeEkrani.getInstance(1).setEnabled(true);
instance.dispose();
}
private void fillUrunInfo() {
jLabelUrunKoduBilgi.setText(urunSatisBilgi.getKod());
jLabelUrunBarkodBilgi
.setText(String.valueOf(urunSatisBilgi.getBarkod()));
jLabelUrunAdetBilgi.setText("1");
jLabelUrunKDVBilgi.setText(String.valueOf(urunSatisBilgi
.getKdvMiktari()));
if (satisBilgi.getVade() == true) {
jLabelUrunFiyat.setText(T_FİYAT);
jLabelUrunFiyatBilgi.setText(DecimalValue
.getDecimalValue(urunSatisBilgi.getTaksitliSatisFiyati()));
} else {
jLabelUrunFiyat.setText(P_FIYAT);
jLabelUrunFiyatBilgi.setText(DecimalValue
.getDecimalValue(urunSatisBilgi.getPesinSatisFiyati()));
}
}
private void fillSatisInfo() {
jLabelSatisIskontoBilgi.setText(DecimalValue.getDecimalValue(satisBilgi
.getIskontoMiktari()));
jLabelSatisKDVBilgi.setText(DecimalValue.getDecimalValue(satisBilgi
.getKdvMiktari()));
if (satisBilgi.getVade() == true) {
jLabelSatisTuruBilgi.setText("VADELİ");
} else {
jLabelSatisTuruBilgi.setText("VADESİZ");
}
jLabelSatisOdemeTuruBilgi.setText(satisBilgi.getOdemeTur());
jLabelSatisTarihBilgi.setText(String.valueOf(satisBilgi.getTarih()));
jLabelSatisTutarBilgi.setText(DecimalValue.getDecimalValue(satisBilgi
.getTutar()));
toplamTutar = satisBilgi.getTutar() - satisBilgi.getIskontoMiktari();
jLabelSatisToplamTutarBilgi.setText(DecimalValue
.getDecimalValue(toplamTutar));
jLabelKampanyaTutarBilgi.setText(DecimalValue
.getDecimalValue(satisBilgi.getKampanyaTutari()));
if (satisBilgi.getPersonel() != null)
jLabelPersonelBilgi.setText(satisBilgi.getPersonel().toString());
if (satisBilgi.getMusteri() != null)
jLabelMusteriBilgi.setText(satisBilgi.getMusteri().toString());
}
}