package gui;
import hibernateSwingApi.component.CButton;
import hibernateSwingApi.component.CComboBox;
import hibernateSwingApi.component.CTable;
import hibernateSwingApi.component.CTextField;
import hibernateSwingApi.component.TablePanel;
import hibernateSwingApi.hibernate.HibernateManager;
import hibernateSwingApi.utils.Utils;
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
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.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import pojos.BankaPOSBilgileri;
import pojos.BekleyenSatis;
import pojos.Kullanici;
import pojos.KullaniciTakip;
import pojos.OdemeBilgileri;
import pojos.Personel;
import pojos.Urun;
import pojos.UrunSatis;
import pojos.UrunStok;
import pojos.YapilanSatis;
import service.AutoClosingMessageDialog;
import service.PSAUtil;
import service.SatisBilgi;
import service.SoundUtil;
import barcode.gui.PSAEtiketBasimEkrani;
import barcode.gui.PSAEtiketSecimEkrani;
import barcode.pojos.PrintProperty;
import control.DecimalControl;
import control.PercentControl;
import control.PriceControl;
import database.DatabaseConnection;
public class PSAAnaEkran extends JFrame {
private static final long serialVersionUID = 1L;
private static PSAAnaEkran instance;
private JTabbedPane jTabbedPaneAnaEkran;
private JPanel cPanelYoneticiSayfasi;
private JPanel cPanelSatis;
private JButton JButtonKullaniciBilgi;
private JButton JButtonKullaniciCikis;
private JButton cEnterButton;
private JPanel cPanelUrunIslemleri;
private TablePanel cTablePanelUrun;
private JLabel cLabelKullanici;
public JLabel cLabelKullaniciAd;
private JLabel cLabelUrunListesi;
private JPanel cPanelSatisListesi;
private JLabel cLabelSatisListesi;
private JPanel cPanelPesinFiyat;
private JLabel cLabelPesinToplam;
private static JLabel cLabelPesinFiyatBilgi;
private JLabel cLabelToplamTL;
private static JButton JButtonVadeUygula;
private JButton JButtonKrediKart;
private JPanel cPanelTaksitFiyat;
private JLabel cLabelTaksitToplam;
private static JLabel cLabelTaksitFiyatBilgi;
private JLabel cLabelToplamTLL;
private JPanel cPanelIskonto;
private JLabel cLabelIskontoYuzde;
private JLabel cLabelToplamKDV;
private static JLabel cLabelToplamKDVBilgi;
private JLabel cLabelToplamKDVTL;
private static CTextField cTextFieldIskontoYuzde;
private JLabel cLabelIskontoTL;
private static CTextField cTextFieldIskontoTL;
private CTextField cTextFieldBarkodVeyaMiktar;
private JButton JButtonNakit;
private JPanel cPanelSatisKismi;
private JPanel cPanelSatisBarkod;
private JPanel numericPad;
private static CComboBox<Personel> cComboBoxPersonelPrim;
private NumericPad panel = new NumericPad();
private JButton JButtonEtiketSecenekleri;
private JButton JButtonKasa;
private Robot robot = null;
private static List<UrunSatis> urunSatisListesi = new LinkedList<>();
private static List<UrunSatis> satilanUrunListesi = new LinkedList<>();
private static CTable cTableSatisListesi;
private JScrollPane scrollPane;
private UrunSatis urunSatis;
private UrunStok urunStok;
private YapilanSatis yapilanSatis;
private BekleyenSatis bekleyenSatis;
private Urun urun;
private Personel personel;
private String musteriBilgi;
private static KullaniciTakip kullaniciTakip;
private static Kullanici kullaniciT;
private static boolean vadeFark = false;
private static boolean stokControl = true;
private static boolean sevkControl = true;
private JButton JButtonIade;
private JPopupMenu pUrunMenu;
private JMenuItem urunMenuItem;
private JMenuItem urunMenuItem2;
private JMenuItem urunMenuItem3;
private JMenuItem urunMenuItem4;
private JMenuItem urunMenuItem5;
private JButton JButtonBarkodBas;
private JButton jButtonKullaniciTakip;
private JButton jButtonPersonelBilgi;
private JLabel jLabelAltiSoftIcon;
private JButton jButtonDetayliArama;
private JButton jButtonMusteri;
private static CTextField cTextFieldMusteriSec;
private JButton jButtonSatisBekletme;
private JPanel jPanelBekleyenSatis;
private JLabel jLabelBekleyenSatisBilgi;
private TablePanel cTablePanelBekleyenSatis;
private JButton jButtonBekleyenSatisSec;
private JButton jButtonBekleyenSatisSil;
private JPanel cPanelButton;
private JButton jBUttonParcaliOdeme;
private JButton jButtonBankaDuzenle;
private JButton jButtonIstatistik;
private OdemeBilgileri odemeBilgisi;
private static final String KULLANICI_IZIN_YOK = "HAYIR";
private static final String NAKİT = "NAKİT";
private static final String KREDI_KART = "KREDİ KART";
private static final String PARCALI_ODEME = "PARÇALI ÖDEME";
private static final String MUSTERI_DEFAULT_VALUE = "Müşteri Seçiniz";
private static final String SEZON = "SEZON";
private static final String DURUM = "YOK";
private int urunSatisSonAdet = 0;
private int urunSatisIlkAdet = 0;
private JButton jButtonSevkEt;
private JButton jButtonSevkOnay;
private JButton jButtonSevkHareketleri;
private CButton JButtonUrunEkle;
private CButton JButtonUrunGuncelle;
private CButton JButtonUrunSil;
private JButton JButtonUrunBilgi;
private JButton JButtonFirmaBilgi;
private static double pesinToplam = 0;
private static double kdvToplam = 0;
public static PSAAnaEkran getInstance(Kullanici kullanici) {
if (kullanici != null) {
instance = new PSAAnaEkran(kullanici);
kullaniciTakipSistemi(kullanici);
}
return instance;
}
private static void kullaniciTakipSistemi(Kullanici kullanici) {
kullaniciT = kullanici;
kullaniciTakip = new KullaniciTakip();
kullaniciTakip.setKullaniciAdi(kullaniciT.getKullaniciAdi());
kullaniciTakip.setGirisSaat(new Date());
}
public PSAAnaEkran(Kullanici kullanici) {
initialize(kullanici);
}
private void initialize(Kullanici kullanici) {
setTitle("PSA MERKEZ ANA EKRAN");
setMinimumSize(new Dimension(1024, 768));
setExtendedState(getExtendedState() | Frame.MAXIMIZED_BOTH);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setIconImage(PSAUtil.getImageIconViaRelativePath("picture/psaIcon.png")
.getImage());
numericPad = panel.numericPad();
pUrunMenu = new JPopupMenu();
urunMenuItem = new JMenuItem("Sil");
pUrunMenu.add(urunMenuItem);
urunMenuItem2 = new JMenuItem("Güncelle");
pUrunMenu.add(urunMenuItem2);
urunMenuItem3 = new JMenuItem("Satış Yap");
pUrunMenu.add(urunMenuItem3);
urunMenuItem4 = new JMenuItem("Etiket Yazdır");
pUrunMenu.add(urunMenuItem4);
urunMenuItem5 = new JMenuItem("Sevk Et");
pUrunMenu.add(urunMenuItem5);
cEnterButton = panel.getcButtonEnter();
cTextFieldBarkodVeyaMiktar = panel.getcTextFieldBarkodVeyaMiktar();
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[] { 1354, 0 };
gridBagLayout.rowHeights = new int[] { 72, 643, 0 };
gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
gridBagLayout.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
getContentPane().setLayout(gridBagLayout);
jTabbedPaneAnaEkran = new JTabbedPane(SwingConstants.TOP);
jTabbedPaneAnaEkran.setFont(new Font("Tahoma", Font.BOLD, 15));
cPanelSatis = new JPanel();
jTabbedPaneAnaEkran
.addTab("Sat\u0131\u015F",
PSAUtil.getImageIconViaRelativePath("picture/satisSayfasi.png"),
cPanelSatis, "Satış ile İlgili İşlemler");
GridBagLayout gbl_cPanelSatis = new GridBagLayout();
gbl_cPanelSatis.columnWidths = new int[] { 202, 671, 471, 0 };
gbl_cPanelSatis.rowHeights = new int[] { 280, 326, 0 };
gbl_cPanelSatis.columnWeights = new double[] { 0.0, 1.0, 1.0,
Double.MIN_VALUE };
gbl_cPanelSatis.rowWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
cPanelSatis.setLayout(gbl_cPanelSatis);
cPanelSatisListesi = new JPanel();
cPanelSatisListesi.setBorder(new LineBorder(new Color(0, 0, 0), 2));
GridBagConstraints gbc_cPanelSatisListesi = new GridBagConstraints();
gbc_cPanelSatisListesi.fill = GridBagConstraints.BOTH;
gbc_cPanelSatisListesi.insets = new Insets(0, 0, 5, 5);
gbc_cPanelSatisListesi.gridwidth = 2;
gbc_cPanelSatisListesi.gridx = 0;
gbc_cPanelSatisListesi.gridy = 0;
cPanelSatis.add(cPanelSatisListesi, gbc_cPanelSatisListesi);
GridBagLayout gbl_cPanelSatisListesi = new GridBagLayout();
gbl_cPanelSatisListesi.columnWidths = new int[] { 673, 197, 0 };
gbl_cPanelSatisListesi.rowHeights = new int[] { 41, 216, 0 };
gbl_cPanelSatisListesi.columnWeights = new double[] { 1.0, 0.0,
Double.MIN_VALUE };
gbl_cPanelSatisListesi.rowWeights = new double[] { 0.0, 1.0,
Double.MIN_VALUE };
cPanelSatisListesi.setLayout(gbl_cPanelSatisListesi);
cLabelSatisListesi = new JLabel();
cLabelSatisListesi.setHorizontalAlignment(SwingConstants.CENTER);
cLabelSatisListesi.setText("SATIŞ LİSTESİ");
cLabelSatisListesi.setFont(new Font("Tahoma", Font.BOLD, 16));
GridBagConstraints gbc_cLabelSatisListesi = new GridBagConstraints();
gbc_cLabelSatisListesi.fill = GridBagConstraints.BOTH;
gbc_cLabelSatisListesi.insets = new Insets(0, 0, 5, 5);
gbc_cLabelSatisListesi.gridx = 0;
gbc_cLabelSatisListesi.gridy = 0;
cPanelSatisListesi.add(cLabelSatisListesi, gbc_cLabelSatisListesi);
jButtonSatisBekletme = new JButton("SATIŞ BEKLETME");
jButtonSatisBekletme.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/satisBeklet.png"));
jButtonSatisBekletme.setFont(new Font("Tahoma", Font.BOLD, 15));
GridBagConstraints gbc_jButtonSatisBekletme = new GridBagConstraints();
gbc_jButtonSatisBekletme.fill = GridBagConstraints.BOTH;
gbc_jButtonSatisBekletme.insets = new Insets(0, 0, 5, 0);
gbc_jButtonSatisBekletme.gridx = 1;
gbc_jButtonSatisBekletme.gridy = 0;
cPanelSatisListesi.add(jButtonSatisBekletme, gbc_jButtonSatisBekletme);
scrollPane = new JScrollPane();
cTableSatisListesi = new CTable((String) null, UrunSatis.class, true,
false);
cTableSatisListesi.setRowHeight(30);
scrollPane.setViewportView(cTableSatisListesi);
GridBagConstraints gbc_scrollPane = new GridBagConstraints();
gbc_scrollPane.fill = GridBagConstraints.BOTH;
gbc_scrollPane.gridwidth = 2;
gbc_scrollPane.gridx = 0;
gbc_scrollPane.gridy = 1;
cPanelSatisListesi.add(scrollPane, gbc_scrollPane);
cTableSatisListesi.setEntityAndColumnName(null, "");
jPanelBekleyenSatis = new JPanel();
jPanelBekleyenSatis.setBorder(new LineBorder(new Color(0, 0, 0), 2));
jPanelBekleyenSatis.setBackground(UIManager.getColor("Button.shadow"));
GridBagConstraints gbc_jPanelBekleyenSatis = new GridBagConstraints();
gbc_jPanelBekleyenSatis.fill = GridBagConstraints.BOTH;
gbc_jPanelBekleyenSatis.insets = new Insets(0, 0, 5, 0);
gbc_jPanelBekleyenSatis.gridx = 2;
gbc_jPanelBekleyenSatis.gridy = 0;
cPanelSatis.add(jPanelBekleyenSatis, gbc_jPanelBekleyenSatis);
GridBagLayout gbl_jPanelBekleyenSatis = new GridBagLayout();
gbl_jPanelBekleyenSatis.columnWidths = new int[] { 231, 226, 0 };
gbl_jPanelBekleyenSatis.rowHeights = new int[] { 32, 151, 41, 0 };
gbl_jPanelBekleyenSatis.columnWeights = new double[] { 1.0, 1.0,
Double.MIN_VALUE };
gbl_jPanelBekleyenSatis.rowWeights = new double[] { 0.0, 1.0, 0.0,
Double.MIN_VALUE };
jPanelBekleyenSatis.setLayout(gbl_jPanelBekleyenSatis);
jLabelBekleyenSatisBilgi = new JLabel();
jLabelBekleyenSatisBilgi.setText("BEKLEYEN SATIŞ LİSTESİ");
jLabelBekleyenSatisBilgi.setHorizontalAlignment(SwingConstants.CENTER);
jLabelBekleyenSatisBilgi.setFont(new Font("Tahoma", Font.BOLD, 16));
GridBagConstraints gbc_jLabelBekleyenSatisBilgi = new GridBagConstraints();
gbc_jLabelBekleyenSatisBilgi.fill = GridBagConstraints.BOTH;
gbc_jLabelBekleyenSatisBilgi.insets = new Insets(0, 0, 5, 0);
gbc_jLabelBekleyenSatisBilgi.gridwidth = 2;
gbc_jLabelBekleyenSatisBilgi.gridx = 0;
gbc_jLabelBekleyenSatisBilgi.gridy = 0;
jPanelBekleyenSatis.add(jLabelBekleyenSatisBilgi,
gbc_jLabelBekleyenSatisBilgi);
cTablePanelBekleyenSatis = new TablePanel((String) null,
BekleyenSatis.class, true, true);
cTablePanelBekleyenSatis.getTable().setAutoResizeMode(
JTable.AUTO_RESIZE_ALL_COLUMNS);
GridBagConstraints gbc_cTablePanelBekleyenSatis = new GridBagConstraints();
gbc_cTablePanelBekleyenSatis.fill = GridBagConstraints.BOTH;
gbc_cTablePanelBekleyenSatis.insets = new Insets(0, 0, 5, 0);
gbc_cTablePanelBekleyenSatis.gridwidth = 2;
gbc_cTablePanelBekleyenSatis.gridx = 0;
gbc_cTablePanelBekleyenSatis.gridy = 1;
jPanelBekleyenSatis.add(cTablePanelBekleyenSatis,
gbc_cTablePanelBekleyenSatis);
jButtonBekleyenSatisSec = new JButton("GETİR");
jButtonBekleyenSatisSec.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/satisGetir.png"));
jButtonBekleyenSatisSec.setEnabled(false);
jButtonBekleyenSatisSec.setFont(new Font("Tahoma", Font.BOLD, 15));
GridBagConstraints gbc_jButtonBekleyenSatisSec = new GridBagConstraints();
gbc_jButtonBekleyenSatisSec.fill = GridBagConstraints.BOTH;
gbc_jButtonBekleyenSatisSec.insets = new Insets(0, 0, 0, 5);
gbc_jButtonBekleyenSatisSec.gridx = 0;
gbc_jButtonBekleyenSatisSec.gridy = 2;
jPanelBekleyenSatis.add(jButtonBekleyenSatisSec,
gbc_jButtonBekleyenSatisSec);
jButtonBekleyenSatisSil = new JButton("SİL");
jButtonBekleyenSatisSil.setEnabled(false);
jButtonBekleyenSatisSil.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/silIcon.png"));
jButtonBekleyenSatisSil.setFont(new Font("Tahoma", Font.BOLD, 15));
GridBagConstraints gbc_jButtonBekleyenSatisSil = new GridBagConstraints();
gbc_jButtonBekleyenSatisSil.fill = GridBagConstraints.BOTH;
gbc_jButtonBekleyenSatisSil.gridx = 1;
gbc_jButtonBekleyenSatisSil.gridy = 2;
jPanelBekleyenSatis.add(jButtonBekleyenSatisSil,
gbc_jButtonBekleyenSatisSil);
cPanelSatisBarkod = new JPanel();
cPanelSatisBarkod.add(numericPad);
GridBagConstraints gbc_cPanelSatisBarkod = new GridBagConstraints();
gbc_cPanelSatisBarkod.anchor = GridBagConstraints.EAST;
gbc_cPanelSatisBarkod.fill = GridBagConstraints.VERTICAL;
gbc_cPanelSatisBarkod.insets = new Insets(0, 0, 0, 5);
gbc_cPanelSatisBarkod.gridx = 0;
gbc_cPanelSatisBarkod.gridy = 1;
cPanelSatis.add(cPanelSatisBarkod, gbc_cPanelSatisBarkod);
cPanelSatisBarkod.setLayout(new BoxLayout(cPanelSatisBarkod,
BoxLayout.X_AXIS));
cPanelSatisBarkod.updateUI();
cPanelSatisKismi = new JPanel();
cPanelSatisKismi.setBorder(new LineBorder(new Color(0, 0, 0), 2));
cPanelSatisKismi.setBackground(SystemColor.inactiveCaption);
GridBagConstraints gbc_cPanelSatisKismi = new GridBagConstraints();
gbc_cPanelSatisKismi.fill = GridBagConstraints.BOTH;
gbc_cPanelSatisKismi.insets = new Insets(0, 0, 0, 5);
gbc_cPanelSatisKismi.gridx = 1;
gbc_cPanelSatisKismi.gridy = 1;
cPanelSatis.add(cPanelSatisKismi, gbc_cPanelSatisKismi);
GridBagLayout gbl_cPanelSatisKismi = new GridBagLayout();
gbl_cPanelSatisKismi.columnWidths = new int[] { 314, 298, 0 };
gbl_cPanelSatisKismi.rowHeights = new int[] { 45, 35, 44, 44, 85, 0 };
gbl_cPanelSatisKismi.columnWeights = new double[] { 1.0, 1.0,
Double.MIN_VALUE };
gbl_cPanelSatisKismi.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0,
1.0, Double.MIN_VALUE };
cPanelSatisKismi.setLayout(gbl_cPanelSatisKismi);
JButtonVadeUygula = new JButton();
JButtonVadeUygula.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/vade.png"));
JButtonVadeUygula.setFont(new Font("Tahoma", Font.BOLD, 15));
JButtonVadeUygula.setText("VADE FARKI UYGULA (F5)");
GridBagConstraints gbc_JButtonVadeUygula = new GridBagConstraints();
gbc_JButtonVadeUygula.fill = GridBagConstraints.BOTH;
gbc_JButtonVadeUygula.insets = new Insets(0, 0, 5, 0);
gbc_JButtonVadeUygula.gridwidth = 2;
gbc_JButtonVadeUygula.gridx = 0;
gbc_JButtonVadeUygula.gridy = 0;
cPanelSatisKismi.add(JButtonVadeUygula, gbc_JButtonVadeUygula);
cComboBoxPersonelPrim = new CComboBox<Personel>(Personel.class);
GridBagConstraints gbc_cComboBoxPersonelPrim = new GridBagConstraints();
gbc_cComboBoxPersonelPrim.fill = GridBagConstraints.BOTH;
gbc_cComboBoxPersonelPrim.insets = new Insets(0, 0, 5, 5);
gbc_cComboBoxPersonelPrim.gridx = 0;
gbc_cComboBoxPersonelPrim.gridy = 1;
cPanelSatisKismi.add(cComboBoxPersonelPrim, gbc_cComboBoxPersonelPrim);
cTextFieldMusteriSec = new CTextField();
cTextFieldMusteriSec.setEditable(false);
cTextFieldMusteriSec.setFont(new Font("Tahoma", Font.BOLD, 16));
cTextFieldMusteriSec.setHorizontalAlignment(SwingConstants.CENTER);
cTextFieldMusteriSec.setText("Müşteri Seçiniz");
GridBagConstraints gbc_cTextFieldMusteriSec = new GridBagConstraints();
gbc_cTextFieldMusteriSec.fill = GridBagConstraints.BOTH;
gbc_cTextFieldMusteriSec.insets = new Insets(0, 0, 5, 0);
gbc_cTextFieldMusteriSec.gridx = 1;
gbc_cTextFieldMusteriSec.gridy = 1;
cPanelSatisKismi.add(cTextFieldMusteriSec, gbc_cTextFieldMusteriSec);
cPanelPesinFiyat = new JPanel();
cPanelPesinFiyat.setBackground(UIManager.getColor("Button.shadow"));
GridBagLayout gbl_cPanelPesinFiyat = new GridBagLayout();
gbl_cPanelPesinFiyat.columnWidths = new int[] { 186, 312, 73, 0 };
gbl_cPanelPesinFiyat.rowHeights = new int[] { 21, 0 };
gbl_cPanelPesinFiyat.columnWeights = new double[] { 1.0, 1.0, 1.0,
Double.MIN_VALUE };
gbl_cPanelPesinFiyat.rowWeights = new double[] { 1.0, Double.MIN_VALUE };
cPanelPesinFiyat.setLayout(gbl_cPanelPesinFiyat);
cLabelPesinToplam = new JLabel();
cLabelPesinToplam.setFont(new Font("Tahoma", Font.BOLD, 15));
cLabelPesinToplam.setText("ARA TOPLAM");
GridBagConstraints gbc_cLabelPesinToplam = new GridBagConstraints();
gbc_cLabelPesinToplam.insets = new Insets(0, 0, 0, 5);
gbc_cLabelPesinToplam.gridx = 0;
gbc_cLabelPesinToplam.gridy = 0;
cPanelPesinFiyat.add(cLabelPesinToplam, gbc_cLabelPesinToplam);
cLabelPesinFiyatBilgi = new JLabel();
cLabelPesinFiyatBilgi.setText("0.00");
cLabelPesinFiyatBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
cLabelPesinFiyatBilgi.setFont(new Font("Tahoma", Font.BOLD, 15));
GridBagConstraints gbc_cLabelPesinFiyatBilgi = new GridBagConstraints();
gbc_cLabelPesinFiyatBilgi.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelPesinFiyatBilgi.insets = new Insets(0, 0, 0, 5);
gbc_cLabelPesinFiyatBilgi.gridx = 1;
gbc_cLabelPesinFiyatBilgi.gridy = 0;
cPanelPesinFiyat.add(cLabelPesinFiyatBilgi, gbc_cLabelPesinFiyatBilgi);
cLabelToplamTL = new JLabel();
cLabelToplamTL.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelToplamTL.setFont(new Font("Tahoma", Font.BOLD, 11));
cLabelToplamTL.setText("TL");
GridBagConstraints gbc_cLabelToplamTL = new GridBagConstraints();
gbc_cLabelToplamTL.anchor = GridBagConstraints.WEST;
gbc_cLabelToplamTL.gridx = 2;
gbc_cLabelToplamTL.gridy = 0;
cPanelPesinFiyat.add(cLabelToplamTL, gbc_cLabelToplamTL);
GridBagConstraints gbc_cPanelPesinFiyat = new GridBagConstraints();
gbc_cPanelPesinFiyat.fill = GridBagConstraints.BOTH;
gbc_cPanelPesinFiyat.insets = new Insets(0, 0, 5, 0);
gbc_cPanelPesinFiyat.gridwidth = 2;
gbc_cPanelPesinFiyat.gridx = 0;
gbc_cPanelPesinFiyat.gridy = 2;
cPanelSatisKismi.add(cPanelPesinFiyat, gbc_cPanelPesinFiyat);
cPanelIskonto = new JPanel();
cPanelIskonto.setBackground(UIManager.getColor("Button.shadow"));
GridBagLayout gbl_cPanelIskonto = new GridBagLayout();
gbl_cPanelIskonto.columnWidths = new int[] { 125, 142, 145, 152, 0, 0 };
gbl_cPanelIskonto.rowHeights = new int[] { 20, 0 };
gbl_cPanelIskonto.columnWeights = new double[] { 1.0, 1.0, 1.0, 1.0,
0.0, Double.MIN_VALUE };
gbl_cPanelIskonto.rowWeights = new double[] { 1.0, Double.MIN_VALUE };
cPanelIskonto.setLayout(gbl_cPanelIskonto);
cLabelIskontoYuzde = new JLabel();
cLabelIskontoYuzde.setText("\u0130skonto %");
cLabelIskontoYuzde.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_cLabelIskontoYuzde = new GridBagConstraints();
gbc_cLabelIskontoYuzde.insets = new Insets(0, 0, 0, 5);
gbc_cLabelIskontoYuzde.gridx = 0;
gbc_cLabelIskontoYuzde.gridy = 0;
cPanelIskonto.add(cLabelIskontoYuzde, gbc_cLabelIskontoYuzde);
cTextFieldIskontoYuzde = new CTextField(5);
cTextFieldIskontoYuzde.addKeyListener(new DecimalControl());
GridBagConstraints gbc_cTextFieldIskontoYuzde = new GridBagConstraints();
gbc_cTextFieldIskontoYuzde.fill = GridBagConstraints.HORIZONTAL;
gbc_cTextFieldIskontoYuzde.insets = new Insets(0, 0, 0, 5);
gbc_cTextFieldIskontoYuzde.gridx = 1;
gbc_cTextFieldIskontoYuzde.gridy = 0;
cPanelIskonto.add(cTextFieldIskontoYuzde, gbc_cTextFieldIskontoYuzde);
cLabelIskontoTL = new JLabel();
cLabelIskontoTL.setHorizontalAlignment(SwingConstants.CENTER);
cLabelIskontoTL.setText("\u0130skonto TL");
cLabelIskontoTL.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_cLabelIskontoTL = new GridBagConstraints();
gbc_cLabelIskontoTL.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelIskontoTL.insets = new Insets(0, 0, 0, 5);
gbc_cLabelIskontoTL.gridx = 2;
gbc_cLabelIskontoTL.gridy = 0;
cPanelIskonto.add(cLabelIskontoTL, gbc_cLabelIskontoTL);
cTextFieldIskontoTL = new CTextField(11);
cTextFieldIskontoTL.addKeyListener(new DecimalControl());
GridBagConstraints gbc_cTextFieldIskontoTL = new GridBagConstraints();
gbc_cTextFieldIskontoTL.insets = new Insets(0, 0, 0, 5);
gbc_cTextFieldIskontoTL.fill = GridBagConstraints.HORIZONTAL;
gbc_cTextFieldIskontoTL.gridx = 3;
gbc_cTextFieldIskontoTL.gridy = 0;
cPanelIskonto.add(cTextFieldIskontoTL, gbc_cTextFieldIskontoTL);
GridBagConstraints gbc_cPanelIskonto = new GridBagConstraints();
gbc_cPanelIskonto.fill = GridBagConstraints.BOTH;
gbc_cPanelIskonto.insets = new Insets(0, 0, 5, 0);
gbc_cPanelIskonto.gridwidth = 2;
gbc_cPanelIskonto.gridx = 0;
gbc_cPanelIskonto.gridy = 3;
cPanelSatisKismi.add(cPanelIskonto, gbc_cPanelIskonto);
cPanelTaksitFiyat = new JPanel();
cPanelTaksitFiyat.setBackground(UIManager.getColor("Button.shadow"));
GridBagLayout gbl_cPanelTaksitFiyat = new GridBagLayout();
gbl_cPanelTaksitFiyat.columnWidths = new int[] { 198, 294, 83, 0 };
gbl_cPanelTaksitFiyat.rowHeights = new int[] { 15, 25, 0 };
gbl_cPanelTaksitFiyat.columnWeights = new double[] { 1.0, 1.0, 1.0,
Double.MIN_VALUE };
gbl_cPanelTaksitFiyat.rowWeights = new double[] { 1.0, 1.0,
Double.MIN_VALUE };
cPanelTaksitFiyat.setLayout(gbl_cPanelTaksitFiyat);
cLabelToplamKDV = new JLabel();
cLabelToplamKDV.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelToplamKDV.setText("TOPLAM KDV TUTARI");
cLabelToplamKDV.setFont(new Font("Tahoma", Font.BOLD, 12));
GridBagConstraints gbc_cLabelToplamKDV = new GridBagConstraints();
gbc_cLabelToplamKDV.insets = new Insets(0, 0, 5, 5);
gbc_cLabelToplamKDV.gridx = 0;
gbc_cLabelToplamKDV.gridy = 0;
cPanelTaksitFiyat.add(cLabelToplamKDV, gbc_cLabelToplamKDV);
cLabelToplamKDVBilgi = new JLabel();
cLabelToplamKDVBilgi.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelToplamKDVBilgi.setText("0.00");
cLabelToplamKDVBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
cLabelToplamKDVBilgi.setFont(new Font("Tahoma", Font.BOLD, 12));
GridBagConstraints gbc_cLabelToplamKDVBilgi = new GridBagConstraints();
gbc_cLabelToplamKDVBilgi.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelToplamKDVBilgi.insets = new Insets(0, 0, 5, 5);
gbc_cLabelToplamKDVBilgi.gridx = 1;
gbc_cLabelToplamKDVBilgi.gridy = 0;
cPanelTaksitFiyat.add(cLabelToplamKDVBilgi, gbc_cLabelToplamKDVBilgi);
cLabelToplamKDVTL = new JLabel();
cLabelToplamKDVTL.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelToplamKDVTL.setText("TL");
cLabelToplamKDVTL.setFont(new Font("Tahoma", Font.BOLD, 9));
GridBagConstraints gbc_cLabelToplamKDVTL = new GridBagConstraints();
gbc_cLabelToplamKDVTL.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelToplamKDVTL.insets = new Insets(0, 0, 5, 0);
gbc_cLabelToplamKDVTL.gridx = 2;
gbc_cLabelToplamKDVTL.gridy = 0;
cPanelTaksitFiyat.add(cLabelToplamKDVTL, gbc_cLabelToplamKDVTL);
cLabelTaksitToplam = new JLabel();
cLabelTaksitToplam.setForeground(new Color(139, 0, 0));
cLabelTaksitToplam.setText("TOPLAM");
cLabelTaksitToplam.setFont(new Font("Tahoma", Font.BOLD, 20));
GridBagConstraints gbc_cLabelTaksitToplam = new GridBagConstraints();
gbc_cLabelTaksitToplam.insets = new Insets(0, 0, 0, 5);
gbc_cLabelTaksitToplam.gridx = 0;
gbc_cLabelTaksitToplam.gridy = 1;
cPanelTaksitFiyat.add(cLabelTaksitToplam, gbc_cLabelTaksitToplam);
cLabelTaksitFiyatBilgi = new JLabel();
cLabelTaksitFiyatBilgi.setForeground(new Color(139, 0, 0));
cLabelTaksitFiyatBilgi.setText("0.00");
cLabelTaksitFiyatBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
cLabelTaksitFiyatBilgi.setFont(new Font("Tahoma", Font.BOLD, 20));
GridBagConstraints gbc_cLabelTaksitFiyatBilgi = new GridBagConstraints();
gbc_cLabelTaksitFiyatBilgi.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelTaksitFiyatBilgi.insets = new Insets(0, 0, 0, 5);
gbc_cLabelTaksitFiyatBilgi.gridx = 1;
gbc_cLabelTaksitFiyatBilgi.gridy = 1;
cPanelTaksitFiyat.add(cLabelTaksitFiyatBilgi,
gbc_cLabelTaksitFiyatBilgi);
cLabelToplamTLL = new JLabel();
cLabelToplamTLL.setForeground(new Color(139, 0, 0));
cLabelToplamTLL.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelToplamTLL.setText("TL");
cLabelToplamTLL.setFont(new Font("Tahoma", Font.BOLD, 14));
GridBagConstraints gbc_cLabelToplamTLL = new GridBagConstraints();
gbc_cLabelToplamTLL.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelToplamTLL.gridx = 2;
gbc_cLabelToplamTLL.gridy = 1;
cPanelTaksitFiyat.add(cLabelToplamTLL, gbc_cLabelToplamTLL);
GridBagConstraints gbc_cPanelTaksitFiyat = new GridBagConstraints();
gbc_cPanelTaksitFiyat.fill = GridBagConstraints.BOTH;
gbc_cPanelTaksitFiyat.gridwidth = 2;
gbc_cPanelTaksitFiyat.gridx = 0;
gbc_cPanelTaksitFiyat.gridy = 4;
cPanelSatisKismi.add(cPanelTaksitFiyat, gbc_cPanelTaksitFiyat);
cPanelButton = new JPanel();
cPanelButton.setBorder(new LineBorder(new Color(0, 0, 0), 2));
GridBagConstraints gbc_cPanelButton = new GridBagConstraints();
gbc_cPanelButton.fill = GridBagConstraints.BOTH;
gbc_cPanelButton.gridx = 2;
gbc_cPanelButton.gridy = 1;
cPanelSatis.add(cPanelButton, gbc_cPanelButton);
GridBagLayout gbl_cPanelButton = new GridBagLayout();
gbl_cPanelButton.columnWidths = new int[] { 213, 210, 0 };
gbl_cPanelButton.rowHeights = new int[] { 143, 155, 0 };
gbl_cPanelButton.columnWeights = new double[] { 1.0, 1.0,
Double.MIN_VALUE };
gbl_cPanelButton.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
cPanelButton.setLayout(gbl_cPanelButton);
JButtonNakit = new JButton();
JButtonNakit.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/pesin.png"));
JButtonNakit.setText("NAKİT (F2)");
JButtonNakit.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_JButtonNakit = new GridBagConstraints();
gbc_JButtonNakit.fill = GridBagConstraints.BOTH;
gbc_JButtonNakit.insets = new Insets(0, 0, 5, 5);
gbc_JButtonNakit.gridx = 0;
gbc_JButtonNakit.gridy = 0;
cPanelButton.add(JButtonNakit, gbc_JButtonNakit);
JButtonKrediKart = new JButton();
JButtonKrediKart.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/visa.png"));
JButtonKrediKart.setFont(new Font("Tahoma", Font.BOLD, 13));
JButtonKrediKart.setText("K.KARTI (F3)");
GridBagConstraints gbc_JButtonKrediKart = new GridBagConstraints();
gbc_JButtonKrediKart.fill = GridBagConstraints.BOTH;
gbc_JButtonKrediKart.insets = new Insets(0, 0, 5, 0);
gbc_JButtonKrediKart.gridx = 1;
gbc_JButtonKrediKart.gridy = 0;
cPanelButton.add(JButtonKrediKart, gbc_JButtonKrediKart);
JButtonIade = new JButton();
JButtonIade.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/iade.png"));
JButtonIade.setText("İADE (F1)");
JButtonIade.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_JButtonIade = new GridBagConstraints();
gbc_JButtonIade.fill = GridBagConstraints.BOTH;
gbc_JButtonIade.insets = new Insets(0, 0, 0, 5);
gbc_JButtonIade.gridx = 0;
gbc_JButtonIade.gridy = 1;
cPanelButton.add(JButtonIade, gbc_JButtonIade);
jBUttonParcaliOdeme = new JButton();
jBUttonParcaliOdeme.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/podeme.png"));
jBUttonParcaliOdeme.setText("P.ÖDEME(F4)");
jBUttonParcaliOdeme.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_jBUttonParcaliOdeme = new GridBagConstraints();
gbc_jBUttonParcaliOdeme.fill = GridBagConstraints.BOTH;
gbc_jBUttonParcaliOdeme.gridx = 1;
gbc_jBUttonParcaliOdeme.gridy = 1;
cPanelButton.add(jBUttonParcaliOdeme, gbc_jBUttonParcaliOdeme);
JPanel jPanelAnaEkran = new JPanel();
GridBagConstraints gbc_jPanelAnaEkran = new GridBagConstraints();
gbc_jPanelAnaEkran.fill = GridBagConstraints.HORIZONTAL;
gbc_jPanelAnaEkran.insets = new Insets(0, 0, 5, 0);
gbc_jPanelAnaEkran.gridx = 0;
gbc_jPanelAnaEkran.gridy = 0;
getContentPane().add(jPanelAnaEkran, gbc_jPanelAnaEkran);
GridBagLayout gbl_jPanelAnaEkran = new GridBagLayout();
gbl_jPanelAnaEkran.columnWidths = new int[] { 223, 530, 65, -75, 87, 0 };
gbl_jPanelAnaEkran.rowHeights = new int[] { 50, 0 };
gbl_jPanelAnaEkran.columnWeights = new double[] { 0.0, 1.0, 0.0, 0.0,
0.0, Double.MIN_VALUE };
gbl_jPanelAnaEkran.rowWeights = new double[] { 0.0, Double.MIN_VALUE };
jPanelAnaEkran.setLayout(gbl_jPanelAnaEkran);
jLabelAltiSoftIcon = new JLabel("");
jLabelAltiSoftIcon.setHorizontalAlignment(SwingConstants.CENTER);
jLabelAltiSoftIcon.setBounds(new Rectangle(500, 0, 0, 0));
jLabelAltiSoftIcon.setSize(100, 50);
jLabelAltiSoftIcon.setIcon(PSAUtil.resizedImageIcon(jLabelAltiSoftIcon,
"/picture/altisoftIcon.png"));
GridBagConstraints gbc_jLabelAltiSoftIcon = new GridBagConstraints();
gbc_jLabelAltiSoftIcon.insets = new Insets(0, 0, 0, 5);
gbc_jLabelAltiSoftIcon.gridx = 0;
gbc_jLabelAltiSoftIcon.gridy = 0;
jPanelAnaEkran.add(jLabelAltiSoftIcon, gbc_jLabelAltiSoftIcon);
cLabelKullanici = new JLabel();
cLabelKullanici.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelKullanici.setHorizontalAlignment(SwingConstants.RIGHT);
cLabelKullanici.setText("Kullan\u0131c\u0131");
cLabelKullanici.setFont(new Font("Tahoma", Font.BOLD, 15));
GridBagConstraints gbc_cLabelKullanici = new GridBagConstraints();
gbc_cLabelKullanici.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelKullanici.insets = new Insets(0, 0, 0, 5);
gbc_cLabelKullanici.gridx = 2;
gbc_cLabelKullanici.gridy = 0;
jPanelAnaEkran.add(cLabelKullanici, gbc_cLabelKullanici);
cLabelKullaniciAd = new JLabel();
cLabelKullaniciAd.setVerticalAlignment(SwingConstants.BOTTOM);
cLabelKullaniciAd.setHorizontalAlignment(SwingConstants.RIGHT);
cLabelKullaniciAd.setFont(new Font("Tahoma", Font.PLAIN, 12));
GridBagConstraints gbc_cLabelKullaniciAd = new GridBagConstraints();
gbc_cLabelKullaniciAd.fill = GridBagConstraints.HORIZONTAL;
gbc_cLabelKullaniciAd.insets = new Insets(0, 0, 0, 5);
gbc_cLabelKullaniciAd.gridx = 3;
gbc_cLabelKullaniciAd.gridy = 0;
jPanelAnaEkran.add(cLabelKullaniciAd, gbc_cLabelKullaniciAd);
JButtonKullaniciCikis = new JButton();
JButtonKullaniciCikis.setSize(new Dimension(50, 50));
JButtonKullaniciCikis.setMinimumSize(new Dimension(53, 9));
JButtonKullaniciCikis.setMaximumSize(new Dimension(53, 9));
JButtonKullaniciCikis.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/cikis.png"));
JButtonKullaniciCikis.setText("\u00C7IKI\u015E");
GridBagConstraints gbc_JButtonKullaniciCikis = new GridBagConstraints();
gbc_JButtonKullaniciCikis.fill = GridBagConstraints.HORIZONTAL;
gbc_JButtonKullaniciCikis.gridx = 4;
gbc_JButtonKullaniciCikis.gridy = 0;
jPanelAnaEkran.add(JButtonKullaniciCikis, gbc_JButtonKullaniciCikis);
cPanelUrunIslemleri = new JPanel();
jTabbedPaneAnaEkran.addTab("Ürün İşlemleri",
PSAUtil.getImageIconViaRelativePath("picture/urunSayfasi.png"),
cPanelUrunIslemleri, "Ürün Bilgisi Kaydetme ve Güncelleme");
GridBagLayout gbl_cPanelUrunIslemleri = new GridBagLayout();
gbl_cPanelUrunIslemleri.columnWidths = new int[] { 1095, 248, 0 };
gbl_cPanelUrunIslemleri.rowHeights = new int[] { 20, 65, 65, 65, 65,
65, 65, 65, 0 };
gbl_cPanelUrunIslemleri.columnWeights = new double[] { 1.0, 0.0,
Double.MIN_VALUE };
gbl_cPanelUrunIslemleri.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE };
cPanelUrunIslemleri.setLayout(gbl_cPanelUrunIslemleri);
cLabelUrunListesi = new JLabel();
cLabelUrunListesi.setText("\u00DCR\u00DCN L\u0130STES\u0130");
cLabelUrunListesi.setFont(new Font("Tahoma", Font.BOLD, 16));
GridBagConstraints gbc_cLabelUrunListesi = new GridBagConstraints();
gbc_cLabelUrunListesi.anchor = GridBagConstraints.NORTHWEST;
gbc_cLabelUrunListesi.insets = new Insets(0, 0, 5, 5);
gbc_cLabelUrunListesi.gridx = 0;
gbc_cLabelUrunListesi.gridy = 0;
cPanelUrunIslemleri.add(cLabelUrunListesi, gbc_cLabelUrunListesi);
cTablePanelUrun = new TablePanel(null, UrunStok.class, true, true);
cTablePanelUrun.getTable().setAutoResizeMode(
JTable.AUTO_RESIZE_ALL_COLUMNS);
cTablePanelUrun.getTable().setRowHeight(25);
cTablePanelUrun.setBorder(new LineBorder(new Color(0, 0, 0), 2));
GridBagConstraints gbc_cTablePanelUrun = new GridBagConstraints();
gbc_cTablePanelUrun.fill = GridBagConstraints.BOTH;
gbc_cTablePanelUrun.insets = new Insets(0, 0, 0, 5);
gbc_cTablePanelUrun.gridheight = 7;
gbc_cTablePanelUrun.gridx = 0;
gbc_cTablePanelUrun.gridy = 1;
cPanelUrunIslemleri.add(cTablePanelUrun, gbc_cTablePanelUrun);
JButtonUrunEkle = new CButton();
JButtonUrunEkle.setFont(new Font("Tahoma", Font.BOLD, 14));
JButtonUrunEkle.setText("YENİ ÜRÜN EKLEME");
JButtonUrunEkle.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/urunEkleme.png"));
GridBagConstraints gbc_JButtonUrunEkle = new GridBagConstraints();
gbc_JButtonUrunEkle.fill = GridBagConstraints.BOTH;
gbc_JButtonUrunEkle.insets = new Insets(0, 0, 5, 0);
gbc_JButtonUrunEkle.gridx = 1;
gbc_JButtonUrunEkle.gridy = 1;
cPanelUrunIslemleri.add(JButtonUrunEkle, gbc_JButtonUrunEkle);
JButtonUrunGuncelle = new CButton();
JButtonUrunGuncelle.setEnabled(false);
JButtonUrunGuncelle.setText("ÜRÜNÜ GÜNCELLE");
JButtonUrunGuncelle.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/kullaniciGuncelle.png"));
JButtonUrunGuncelle.setFont(new Font("Tahoma", Font.BOLD, 14));
GridBagConstraints gbc_JButtonUrunGuncelle = new GridBagConstraints();
gbc_JButtonUrunGuncelle.fill = GridBagConstraints.BOTH;
gbc_JButtonUrunGuncelle.insets = new Insets(0, 0, 5, 0);
gbc_JButtonUrunGuncelle.gridx = 1;
gbc_JButtonUrunGuncelle.gridy = 2;
cPanelUrunIslemleri.add(JButtonUrunGuncelle, gbc_JButtonUrunGuncelle);
JButtonUrunSil = new CButton();
JButtonUrunSil.setEnabled(false);
JButtonUrunSil.setText("ÜRÜN SİL");
JButtonUrunSil.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/silIcon.png"));
JButtonUrunSil.setFont(new Font("Tahoma", Font.BOLD, 14));
GridBagConstraints gbc_JButtonUrunSil = new GridBagConstraints();
gbc_JButtonUrunSil.fill = GridBagConstraints.BOTH;
gbc_JButtonUrunSil.insets = new Insets(0, 0, 5, 0);
gbc_JButtonUrunSil.gridx = 1;
gbc_JButtonUrunSil.gridy = 3;
cPanelUrunIslemleri.add(JButtonUrunSil, gbc_JButtonUrunSil);
JButtonBarkodBas = new JButton();
JButtonBarkodBas.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/barkod.png"));
JButtonBarkodBas.setText("ETİKET YAZDIR");
JButtonBarkodBas.setFont(new Font("Tahoma", Font.BOLD, 14));
JButtonBarkodBas.setEnabled(false);
GridBagConstraints gbc_JButtonBarkodBas = new GridBagConstraints();
gbc_JButtonBarkodBas.fill = GridBagConstraints.BOTH;
gbc_JButtonBarkodBas.insets = new Insets(0, 0, 5, 0);
gbc_JButtonBarkodBas.gridx = 1;
gbc_JButtonBarkodBas.gridy = 4;
cPanelUrunIslemleri.add(JButtonBarkodBas, gbc_JButtonBarkodBas);
jButtonDetayliArama = new JButton();
jButtonDetayliArama.setText("DETAYLI ARAMA");
jButtonDetayliArama.setFont(new Font("Tahoma", Font.BOLD, 14));
jButtonDetayliArama.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/detayliArama.png"));
GridBagConstraints gbc_jButtonDetayliArama = new GridBagConstraints();
gbc_jButtonDetayliArama.fill = GridBagConstraints.BOTH;
gbc_jButtonDetayliArama.insets = new Insets(0, 0, 5, 0);
gbc_jButtonDetayliArama.gridx = 1;
gbc_jButtonDetayliArama.gridy = 5;
cPanelUrunIslemleri.add(jButtonDetayliArama, gbc_jButtonDetayliArama);
jButtonSevkEt = new JButton();
jButtonSevkEt.setEnabled(false);
jButtonSevkEt.setText("SEVK ET");
jButtonSevkEt.setFont(new Font("Tahoma", Font.BOLD, 14));
jButtonSevkEt.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/sevkEt.png"));
GridBagConstraints gbc_jButtonSevkEt = new GridBagConstraints();
gbc_jButtonSevkEt.fill = GridBagConstraints.BOTH;
gbc_jButtonSevkEt.insets = new Insets(0, 0, 5, 0);
gbc_jButtonSevkEt.gridx = 1;
gbc_jButtonSevkEt.gridy = 6;
cPanelUrunIslemleri.add(jButtonSevkEt, gbc_jButtonSevkEt);
jButtonSevkOnay = new JButton();
jButtonSevkOnay.setText("SEVK BİLGİSİ");
jButtonSevkOnay.setFont(new Font("Tahoma", Font.BOLD, 14));
jButtonSevkOnay.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/sevkBilgi.png"));
GridBagConstraints gbc_jButtonSevkOnay = new GridBagConstraints();
gbc_jButtonSevkOnay.fill = GridBagConstraints.BOTH;
gbc_jButtonSevkOnay.gridx = 1;
gbc_jButtonSevkOnay.gridy = 7;
cPanelUrunIslemleri.add(jButtonSevkOnay, gbc_jButtonSevkOnay);
cPanelYoneticiSayfasi = new JPanel();
jTabbedPaneAnaEkran.addTab("Yönetici İşlemleri", PSAUtil
.getImageIconViaRelativePath("picture/yoneticiSayfasi.png"),
cPanelYoneticiSayfasi,
"Sistem ile İlgili Veri Ekleme Ve Kontrol Sayfasi");
GridBagLayout gbl_cPanelYoneticiSayfasi = new GridBagLayout();
gbl_cPanelYoneticiSayfasi.columnWidths = new int[] { 5, 100, 5, 100, 5,
100, 5, 0 };
gbl_cPanelYoneticiSayfasi.rowHeights = new int[] { 24, 110, 5, 110, 5,
110, 0, 110, 0, 0 };
gbl_cPanelYoneticiSayfasi.columnWeights = new double[] { 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE };
gbl_cPanelYoneticiSayfasi.rowWeights = new double[] { 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE };
cPanelYoneticiSayfasi.setLayout(gbl_cPanelYoneticiSayfasi);
jButtonMusteri = new JButton();
jButtonMusteri.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/cari-ekle.png"));
jButtonMusteri.setText("MÜŞTERİ DÜZENLE");
jButtonMusteri.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_jButtonMusteri = new GridBagConstraints();
gbc_jButtonMusteri.fill = GridBagConstraints.BOTH;
gbc_jButtonMusteri.insets = new Insets(0, 0, 5, 5);
gbc_jButtonMusteri.gridx = 1;
gbc_jButtonMusteri.gridy = 1;
cPanelYoneticiSayfasi.add(jButtonMusteri, gbc_jButtonMusteri);
jButtonPersonelBilgi = new JButton("PERSONEL BİLGİLERİ DÜZENLE");
jButtonPersonelBilgi.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/personelIcon.png"));
jButtonPersonelBilgi.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_jButtonPersonelBilgi = new GridBagConstraints();
gbc_jButtonPersonelBilgi.fill = GridBagConstraints.BOTH;
gbc_jButtonPersonelBilgi.insets = new Insets(0, 0, 5, 5);
gbc_jButtonPersonelBilgi.gridx = 3;
gbc_jButtonPersonelBilgi.gridy = 1;
cPanelYoneticiSayfasi.add(jButtonPersonelBilgi,
gbc_jButtonPersonelBilgi);
JButtonKullaniciBilgi = new JButton();
JButtonKullaniciBilgi.setEnabled(false);
JButtonKullaniciBilgi.setText("KULLANICILARI D\u00DCZENLE");
JButtonKullaniciBilgi.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/kulaniciIcon.png"));
JButtonKullaniciBilgi.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_JButtonKullaniciBilgi = new GridBagConstraints();
gbc_JButtonKullaniciBilgi.fill = GridBagConstraints.BOTH;
gbc_JButtonKullaniciBilgi.insets = new Insets(0, 0, 5, 5);
gbc_JButtonKullaniciBilgi.gridx = 5;
gbc_JButtonKullaniciBilgi.gridy = 1;
cPanelYoneticiSayfasi.add(JButtonKullaniciBilgi,
gbc_JButtonKullaniciBilgi);
JButtonEtiketSecenekleri = new JButton();
JButtonEtiketSecenekleri.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/etiketDuzenle.png"));
JButtonEtiketSecenekleri.setText("ET\u0130KET D\u00DCZENLE");
JButtonEtiketSecenekleri.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_JButtonEtiketSecenekleri = new GridBagConstraints();
gbc_JButtonEtiketSecenekleri.fill = GridBagConstraints.BOTH;
gbc_JButtonEtiketSecenekleri.insets = new Insets(0, 0, 5, 5);
gbc_JButtonEtiketSecenekleri.gridx = 1;
gbc_JButtonEtiketSecenekleri.gridy = 3;
cPanelYoneticiSayfasi.add(JButtonEtiketSecenekleri,
gbc_JButtonEtiketSecenekleri);
JButtonKasa = new JButton();
JButtonKasa.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/kasa.png"));
JButtonKasa.setText("SATI\u015E B\u0130LG\u0130LER\u0130");
JButtonKasa.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_JButtonKasa = new GridBagConstraints();
gbc_JButtonKasa.fill = GridBagConstraints.BOTH;
gbc_JButtonKasa.insets = new Insets(0, 0, 5, 5);
gbc_JButtonKasa.gridx = 3;
gbc_JButtonKasa.gridy = 3;
cPanelYoneticiSayfasi.add(JButtonKasa, gbc_JButtonKasa);
jButtonBankaDuzenle = new JButton();
jButtonBankaDuzenle.setText("BANKA BİLGİLERİ DÜZENLE");
jButtonBankaDuzenle.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/banka.png"));
jButtonBankaDuzenle.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_jButtonBankaDuzenle = new GridBagConstraints();
gbc_jButtonBankaDuzenle.fill = GridBagConstraints.BOTH;
gbc_jButtonBankaDuzenle.insets = new Insets(0, 0, 5, 5);
gbc_jButtonBankaDuzenle.gridx = 5;
gbc_jButtonBankaDuzenle.gridy = 3;
cPanelYoneticiSayfasi.add(jButtonBankaDuzenle, gbc_jButtonBankaDuzenle);
jButtonSevkHareketleri = new JButton();
jButtonSevkHareketleri.setText("SEVK HAREKETLERİ");
jButtonSevkHareketleri.setFont(new Font("Tahoma", Font.BOLD, 13));
jButtonSevkHareketleri.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/sevkHareketleri.png"));
GridBagConstraints gbc_jButtonSevkHareketleri = new GridBagConstraints();
gbc_jButtonSevkHareketleri.fill = GridBagConstraints.BOTH;
gbc_jButtonSevkHareketleri.insets = new Insets(0, 0, 5, 5);
gbc_jButtonSevkHareketleri.gridx = 1;
gbc_jButtonSevkHareketleri.gridy = 5;
cPanelYoneticiSayfasi.add(jButtonSevkHareketleri,
gbc_jButtonSevkHareketleri);
jButtonKullaniciTakip = new JButton();
jButtonKullaniciTakip.setEnabled(false);
jButtonKullaniciTakip.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/kullaniciTakip.png"));
jButtonKullaniciTakip.setText("KULLANICI TAKİP");
jButtonKullaniciTakip.setFont(new Font("Tahoma", Font.BOLD, 13));
GridBagConstraints gbc_jButtonKullaniciTakip = new GridBagConstraints();
gbc_jButtonKullaniciTakip.fill = GridBagConstraints.BOTH;
gbc_jButtonKullaniciTakip.insets = new Insets(0, 0, 5, 5);
gbc_jButtonKullaniciTakip.gridx = 3;
gbc_jButtonKullaniciTakip.gridy = 5;
cPanelYoneticiSayfasi.add(jButtonKullaniciTakip,
gbc_jButtonKullaniciTakip);
jButtonIstatistik = new JButton();
jButtonIstatistik.setText("İSTATİSTİK");
jButtonIstatistik.setFont(new Font("Tahoma", Font.BOLD, 13));
jButtonIstatistik.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/istatistik.png"));
GridBagConstraints gbc_jButtonIstatistik = new GridBagConstraints();
gbc_jButtonIstatistik.fill = GridBagConstraints.BOTH;
gbc_jButtonIstatistik.insets = new Insets(0, 0, 5, 5);
gbc_jButtonIstatistik.gridx = 5;
gbc_jButtonIstatistik.gridy = 5;
cPanelYoneticiSayfasi.add(jButtonIstatistik, gbc_jButtonIstatistik);
JButtonUrunBilgi = new JButton("KATEGORİ DÜZENLE");
JButtonUrunBilgi.setFont(new Font("Tahoma", Font.BOLD, 13));
JButtonUrunBilgi.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/urunKategori.png"));
GridBagConstraints gbc_JButtonUrunBilgi = new GridBagConstraints();
gbc_JButtonUrunBilgi.fill = GridBagConstraints.BOTH;
gbc_JButtonUrunBilgi.insets = new Insets(0, 0, 5, 5);
gbc_JButtonUrunBilgi.gridx = 1;
gbc_JButtonUrunBilgi.gridy = 7;
cPanelYoneticiSayfasi.add(JButtonUrunBilgi, gbc_JButtonUrunBilgi);
JButtonFirmaBilgi = new JButton("FİRMA BİLGİLERİNİ DÜZENLE");
JButtonFirmaBilgi.setFont(new Font("Tahoma", Font.BOLD, 13));
JButtonFirmaBilgi.setIcon(PSAUtil
.getImageIconViaRelativePath("picture/firmaBilgileri.png"));
GridBagConstraints gbc_JButtonFirmaBilgi = new GridBagConstraints();
gbc_JButtonFirmaBilgi.fill = GridBagConstraints.BOTH;
gbc_JButtonFirmaBilgi.insets = new Insets(0, 0, 5, 5);
gbc_JButtonFirmaBilgi.gridx = 3;
gbc_JButtonFirmaBilgi.gridy = 7;
cPanelYoneticiSayfasi.add(JButtonFirmaBilgi, gbc_JButtonFirmaBilgi);
GridBagConstraints gbc_jTabbedPaneAnaEkran = new GridBagConstraints();
gbc_jTabbedPaneAnaEkran.fill = GridBagConstraints.BOTH;
gbc_jTabbedPaneAnaEkran.gridx = 0;
gbc_jTabbedPaneAnaEkran.gridy = 1;
getContentPane().add(jTabbedPaneAnaEkran, gbc_jTabbedPaneAnaEkran);
refreshTable();
userPermissionControl(kullanici);
personelBilgileriDoldur();
initListeners();
}
private void refreshTable() {
cTablePanelUrun.refresh();
cTablePanelBekleyenSatis.refresh();
}
public void userPermissionControl(Kullanici kullanici) {
cLabelKullaniciAd.setText(kullanici.getKullaniciAdi());
if (kullanici.isAdmin() == true) {
JButtonKullaniciBilgi.setEnabled(true);
jButtonKullaniciTakip.setEnabled(true);
} else {
if (kullanici.getFirma().equals(KULLANICI_IZIN_YOK)) {
JButtonFirmaBilgi.setEnabled(false);
}
if (kullanici.getKategori().equals(KULLANICI_IZIN_YOK)) {
JButtonUrunBilgi.setEnabled(false);
}
if (kullanici.getStok().equals(KULLANICI_IZIN_YOK)) {
stokControl = false;
JButtonUrunEkle.setEnabled(false);
JButtonUrunGuncelle.setEnabled(false);
JButtonUrunSil.setEnabled(false);
}
if (kullanici.getPersonel().equals(KULLANICI_IZIN_YOK)) {
jButtonPersonelBilgi.setEnabled(false);
}
if (kullanici.getMüsteri().equals(KULLANICI_IZIN_YOK)) {
jButtonMusteri.setEnabled(false);
}
if (kullanici.getKasa().equals(KULLANICI_IZIN_YOK)) {
JButtonKasa.setEnabled(false);
}
if (kullanici.getUrunSevk().equals(KULLANICI_IZIN_YOK)) {
sevkControl = false;
jButtonSevkEt.setEnabled(false);
}
if (kullanici.getUrunSevkBilgi().equals(KULLANICI_IZIN_YOK)) {
jButtonSevkOnay.setEnabled(false);
}
if (kullanici.getUrun().equals(KULLANICI_IZIN_YOK)) {
jTabbedPaneAnaEkran.setEnabledAt(1, false);
}
if (kullanici.getYonetici().equals(KULLANICI_IZIN_YOK)) {
jTabbedPaneAnaEkran.setEnabledAt(2, false);
}
if (kullanici.getEtiket().equals(KULLANICI_IZIN_YOK)) {
JButtonEtiketSecenekleri.setEnabled(false);
}
if (kullanici.getBanka().equals(KULLANICI_IZIN_YOK)) {
jButtonBankaDuzenle.setEnabled(false);
}
if (kullanici.getIstatistik().equals(KULLANICI_IZIN_YOK)) {
jButtonIstatistik.setEnabled(false);
}
}
for (int i = 0; i < jTabbedPaneAnaEkran.getTabCount(); i++) {
if (jTabbedPaneAnaEkran.isEnabledAt(i) == true) {
jTabbedPaneAnaEkran.setSelectedIndex(i);
break;
}
}
}
private static void personelBilgileriDoldur() {
Personel per = new Personel();
per.setAd("Personel");
per.setSoyad("Seçiniz");
cComboBoxPersonelPrim.setInitialObject(per);
cComboBoxPersonelPrim.refresh();
}
private void initListeners() {
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
if (satisListesiControl()) {
cikisButtonClicked(1);
} else {
instance.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
}
});
jButtonSevkHareketleri.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sevkHareketleriClicked();
}
});
jButtonSevkOnay.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sevkBilgisiCliked();
}
});
cComboBoxPersonelPrim.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
if (evt.getStateChange() == ItemEvent.SELECTED) {
cTextFieldBarkodVeyaMiktar.requestFocus();
}
}
});
jTabbedPaneAnaEkran.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent arg0) {
if (jTabbedPaneAnaEkran.getSelectedIndex() == 0) {
cTextFieldBarkodVeyaMiktar.requestFocus();
}
}
});
jButtonIstatistik.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
istatistikClicked();
}
});
JButtonKullaniciCikis.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (satisListesiControl()) {
cikisButtonClicked(0);
}
}
});
cTextFieldMusteriSec.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
musteriSecCLicked();
}
});
jButtonBankaDuzenle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
bankaBilgileriDuzenle();
}
});
JButtonUrunBilgi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
urunBilgiClicked();
}
});
JButtonFirmaBilgi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
firmaBilgiClicked();
}
});
JButtonKullaniciBilgi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
kullaniciBilgiClicked();
}
});
jButtonMusteri.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
musteriBilgiClicked();
}
});
cTablePanelUrun.getTable().getSelectionModel()
.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
urun = (Urun) cTablePanelUrun.getSelectedObject();
if (urun == null) {
JButtonUrunGuncelle.setEnabled(false);
JButtonUrunSil.setEnabled(false);
JButtonBarkodBas.setEnabled(false);
jButtonSevkEt.setEnabled(false);
} else {
if (stokControl == true) {
JButtonUrunGuncelle.setEnabled(true);
JButtonUrunSil.setEnabled(true);
}
if (sevkControl == true) {
jButtonSevkEt.setEnabled(true);
}
JButtonBarkodBas.setEnabled(true);
}
}
});
urunMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (urunPermissionControl() == true) {
urunSilClicked();
}
}
});
urunMenuItem2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (urunPermissionControl() == true) {
urunGuncelleClicked();
}
}
});
urunMenuItem3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
urunSatisClicked();
}
});
urunMenuItem4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JButtonBarkodBas.doClick();
}
});
urunMenuItem5.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (urunSevkPermissionControl() == true) {
jButtonSevkEt.doClick();
}
}
});
JButtonUrunEkle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
urunEkleClicked();
}
});
JButtonUrunGuncelle.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (urunPermissionControl() == true) {
urunGuncelleClicked();
}
}
});
JButtonUrunSil.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
urunSilClicked();
}
});
cTablePanelUrun.getTable().addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
urunTablePopupMenu(e);
}
@Override
public void mousePressed(MouseEvent e) {
urunTablePopupMenu(e);
}
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (urunPermissionControl() == true) {
urunGuncelleClicked();
}
}
}
});
jButtonSevkEt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
urunSevkClicked();
}
});
jButtonDetayliArama.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
detayliAramaClicked();
}
});
JButtonBarkodBas.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
barkodBasClicked();
}
});
JButtonVadeUygula.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
vadeUygulaClicked();
}
});
cEnterButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
enterClicked();
}
});
cTablePanelBekleyenSatis.getTable().getSelectionModel()
.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
bekleyenSatis = (BekleyenSatis) cTablePanelBekleyenSatis
.getSelectedObject();
if (bekleyenSatis == null) {
jButtonBekleyenSatisSil.setEnabled(false);
jButtonBekleyenSatisSec.setEnabled(false);
} else {
jButtonBekleyenSatisSil.setEnabled(true);
jButtonBekleyenSatisSec.setEnabled(true);
}
}
});
jButtonSatisBekletme.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (urunSatisListesi.size() < 1) {
AutoClosingMessageDialog
.showAutoClosingMessageDialog(
"Satışta ürün bulunmadığından satış bekleme yapılmamaktadır.",
2);
return;
}
satisBekletmeClicked();
}
});
jButtonBekleyenSatisSec.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
bekleyenSatisSecClicked();
}
});
jButtonBekleyenSatisSil.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
bekleyenSatisSilClicked();
}
});
cTableSatisListesi.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent evt) {
cTableSatisListesiSilClicked();
}
});
cTableSatisListesi.getModel().addTableModelListener(
new TableModelListener() {
@Override
public void tableChanged(TableModelEvent evt) {
cTableSatisListesiAdetClicked(evt);
}
});
cTextFieldIskontoTL.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent arg0) {
try {
robot = new Robot();
if (!cTextFieldIskontoTL.getText().equals("")) {
if (PriceControl.validate(cTextFieldIskontoTL.getText())) {
if (Double.parseDouble(cTextFieldIskontoTL
.getText()) < pesinToplam) {
String iskontoYuzde;
double iskontoluFiyat = pesinToplam
- Double.parseDouble(cTextFieldIskontoTL
.getText());
String[] iskontoYuzdeList = decimalControl(String
.valueOf(((1 - (iskontoluFiyat / pesinToplam)) * 100)));
if (iskontoYuzdeList[1].length() > 1) {
iskontoYuzde = iskontoYuzdeList[0]
+ "."
+ iskontoYuzdeList[1].substring(0,
2);
} else {
iskontoYuzde = iskontoYuzdeList[0]
+ "."
+ iskontoYuzdeList[1].substring(0,
1);
}
getVal(iskontoYuzde, iskontoluFiyat,
"iskontoTL");
} else {
robot.keyPress(KeyEvent.VK_BACK_SPACE);
robot.keyRelease(KeyEvent.VK_BACK_SPACE);
}
} else {
robot.keyPress(KeyEvent.VK_BACK_SPACE);
robot.keyRelease(KeyEvent.VK_BACK_SPACE);
}
}
} catch (AWTException e) {
e.printStackTrace();
}
}
});
cTextFieldIskontoTL.getDocument().addDocumentListener(
new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
}
@Override
public void removeUpdate(DocumentEvent e) {
update();
}
@Override
public void insertUpdate(DocumentEvent e) {
}
public void update() {
if (cTextFieldIskontoTL.getText().equals("")) {
cTextFieldIskontoYuzde.setText("");
cLabelTaksitFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(pesinToplam));
}
}
});
cTextFieldIskontoYuzde.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent arg0) {
if (!cTextFieldIskontoYuzde.getText().equals("")) {
if (PercentControl.validate(cTextFieldIskontoYuzde
.getText())) {
double iskontoluFiyat = pesinToplam
- pesinToplam
/ 100
* Double.parseDouble(cTextFieldIskontoYuzde
.getText());
String iskonto = String.valueOf(pesinToplam
- iskontoluFiyat);
String[] iskontoYuzdeList = decimalControl(iskonto);
if (iskontoYuzdeList[1].length() > 1) {
iskonto = iskontoYuzdeList[0] + "."
+ iskontoYuzdeList[1].substring(0, 2);
} else {
iskonto = iskontoYuzdeList[0] + "."
+ iskontoYuzdeList[1].substring(0, 1);
}
getVal(iskonto, iskontoluFiyat, "iskontoYüzde");
} else {
try {
robot = new Robot();
robot.keyPress(KeyEvent.VK_BACK_SPACE);
robot.keyRelease(KeyEvent.VK_BACK_SPACE);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
}
});
cTextFieldIskontoYuzde.getDocument().addDocumentListener(
new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
}
@Override
public void removeUpdate(DocumentEvent e) {
update();
}
@Override
public void insertUpdate(DocumentEvent e) {
}
public void update() {
if (cTextFieldIskontoYuzde.getText().equals("")) {
cTextFieldIskontoTL.setText("");
cLabelTaksitFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(pesinToplam));
}
}
});
JButtonNakit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
nakitButtonClicked();
}
});
JButtonKrediKart.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
krediKartButtonClicked(KREDI_KART);
}
});
JButtonIade.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
iadeButtonClicked();
}
});
jBUttonParcaliOdeme.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
krediKartButtonClicked(PARCALI_ODEME);
}
});
JButtonEtiketSecenekleri.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
etiketSecenekleriClicked();
}
});
JButtonKasa.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
kasaButtonClicked();
}
});
cTextFieldIskontoTL.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
keyListenerAction(e.getKeyCode());
}
});
cTextFieldIskontoYuzde.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
keyListenerAction(e.getKeyCode());
}
});
cTextFieldBarkodVeyaMiktar.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyPressed(KeyEvent e) {
keyListenerAction(e.getKeyCode());
}
});
jButtonKullaniciTakip.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
kullaniciTakipClicked();
}
});
jButtonPersonelBilgi.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
personelBilgiClicked();
}
});
}
// protected void addStok() {
// if (urunSatisListesi.size() > 0) {
// for (int i = 0; i < urunSatisListesi.size(); i++) {
// urunSatis = urunSatisListesi.get(i);
// urunStok = (UrunStok) HibernateManager.getInstance()
// .getObjectWithUniqueColumn(UrunStok.class, "barkod",
// urunSatis.getBarkod());
// urunStok.setAdet(urunStok.getAdet() + urunSatis.getAdet());
// HibernateManager.getInstance().update(urunStok);
// }
// }
// }
protected void firmaBilgiClicked() {
DatabaseConnection.databaseConnect();
PSAFirmaEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
protected void urunBilgiClicked() {
DatabaseConnection.databaseConnect();
PSAUrunKategoriGuncelleme.getInstance(SEZON, DURUM, 0).setVisible(true);
setEnabled(false);
}
protected void urunSilClicked() {
int selectedOption = JOptionPane.showOptionDialog(null,
"Ürünü silmek istediğinizden emin misiniz?", "SİSTEM UYARISI",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE,
null, new String[] { "EVET", "HAYIR" }, "default");
if (selectedOption == JOptionPane.OK_OPTION) {
boolean check = HibernateManager.getInstance().delete(urun);
if (check) {
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Ürün sistemden başarı ile silinmiştir.", 2);
}
cTablePanelUrun.getTable().clearSelection();
}
}
protected void urunGuncelleClicked() {
DatabaseConnection.databaseConnect();
PSAUrunGuncellemeEkrani.getInstance(urun).setVisible(true);
setEnabled(false);
}
protected void urunEkleClicked() {
DatabaseConnection.databaseConnect();
PSAUrunEklemeEkrani.getInstance(0, 0).setVisible(true);
setEnabled(false);
}
protected void sevkHareketleriClicked() {
DatabaseConnection.databaseConnect();
PSASevkHareketleriEkrani.getInstance().setVisible(true);
setEnabled(false);
}
protected void urunSevkClicked() {
DatabaseConnection.databaseConnect();
PSAUrunSevk.getInstance(urun).setVisible(true);
setEnabled(false);
}
protected void sevkBilgisiCliked() {
DatabaseConnection.databaseConnect();
PSAUrunSevkBilgisiEkrani.getInstance().setVisible(true);
setEnabled(false);
}
protected void etiketSecenekleriClicked() {
instance.setEnabled(false);
PSAEtiketSecimEkrani etiketSecimEkrani = new PSAEtiketSecimEkrani();
if (!etiketSecimEkrani.getFrame().isVisible()) {
etiketSecimEkrani.getFrame().setVisible(true);
}
}
protected void cTableSatisListesiAdetClicked(TableModelEvent evt) {
if (evt.getType() == TableModelEvent.UPDATE) {
UrunSatis guncelUrunSatis = (UrunSatis) cTableSatisListesi
.getEditedObject(evt);
if (guncelUrunSatis == null)
return;
urunSatisSonAdet = guncelUrunSatis.getAdet();
urunStok = (UrunStok) HibernateManager.getInstance()
.getObjectWithUniqueColumn(UrunStok.class, "barkod",
guncelUrunSatis.getBarkod());
if ((urunSatisSonAdet - urunSatisIlkAdet) > urunStok.getAdet()) {
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Sistemde yeteri kadar ürün bulunmamaktadır.", 2);
guncelUrunSatis.setAdet((int) cTableSatisListesi
.getLastEditedValue());
return;
} else {
urunStok.setAdet(urunStok.getAdet()
- (urunSatisSonAdet - urunSatisIlkAdet));
HibernateManager.getInstance().update(urunStok);
cTableSatisListesi.setObjects(urunSatisListesi);
vadeFarkControl();
}
}
}
protected void cTableSatisListesiSilClicked() {
urunSatis = (UrunSatis) cTableSatisListesi.getSelectedObject();
urunSatisIlkAdet = urunSatis.getAdet();
if (cTableSatisListesi.getModel()
.getColumnName(cTableSatisListesi.getSelectedColumn())
.equals(" ")) {
urunStok = (UrunStok) HibernateManager.getInstance()
.getObjectWithUniqueColumn(UrunStok.class, "barkod",
urunSatis.getBarkod());
urunStok.setAdet(urunStok.getAdet() + urunSatis.getAdet());
HibernateManager.getInstance().update(urunStok);
urunSatisListesi.remove(cTableSatisListesi.getSelectedRow());
cTableSatisListesi.setObjects(urunSatisListesi);
vadeFarkControl();
}
cTextFieldBarkodVeyaMiktar.requestFocus();
}
protected void barkodBasClicked() {
@SuppressWarnings("unchecked")
List<PrintProperty> property = (List<PrintProperty>) HibernateManager
.getInstance().get(PrintProperty.class);
if (property == null || property.size() <= 0) {
Utils.showMessage("Kayıtlı yazıcı seçeneği bulunmamaktadır !");
return;
}
PSAEtiketBasimEkrani etiketBasim = new PSAEtiketBasimEkrani(
property.get(0));
etiketBasim.setUrun((UrunStok) cTablePanelUrun.getSelectedObject());
etiketBasim.getFrame().setVisible(true);
setEnabled(false);
}
protected void musteriBilgiClicked() {
DatabaseConnection.databaseConnect();
PSAMusteriEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
protected void istatistikClicked() {
DatabaseConnection.databaseConnect();
PSAIstatistikEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
protected void bankaBilgileriDuzenle() {
PSAPOSBilgileriEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
protected boolean satisListesiControl() {
if (cTableSatisListesi.getRowCount() > 0) {
AutoClosingMessageDialog
.showAutoClosingMessageDialog(
"Satış listesini bekletmeye alıp veya boşaltıp çıkabilirsiniz.",
2);
return false;
}
return true;
}
protected void musteriSecCLicked() {
PSAMusteriSecimEkrani ms = new PSAMusteriSecimEkrani(instance);
musteriBilgi = ms.showDialog();
if (musteriBilgi.equals(MUSTERI_DEFAULT_VALUE)) {
cTextFieldMusteriSec.setText(musteriBilgi);
} else {
cTextFieldMusteriSec.setText("MÜŞTERİ : " + musteriBilgi);
}
}
protected void bekleyenSatisSilClicked() {
int selectedOption = JOptionPane.showOptionDialog(null,
"Bekleyen satışı silmek istediğinizden emin misiniz?",
"SİSTEM UYARISI", JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, new String[] { "EVET",
"HAYIR" }, "default");
if (selectedOption == JOptionPane.OK_OPTION) {
addBekleyenSatisStok(bekleyenSatis);
boolean check = HibernateManager.getInstance()
.delete(bekleyenSatis);
if (check) {
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Bekleyen satış silinmiştir.", 2);
getDefaultValue();
}
}
}
@SuppressWarnings("unchecked")
private static void addBekleyenSatisStok(BekleyenSatis bekleyenSatisControl) {
List<UrunSatis> bekleyenSatisUrunListesi = (List<UrunSatis>) HibernateManager
.getInstance().getEntitysList(bekleyenSatisControl,
"satisListesi");
for (int i = 0; i < bekleyenSatisUrunListesi.size(); i++) {
UrunSatis us = bekleyenSatisUrunListesi.get(i);
UrunStok urunS = (UrunStok) HibernateManager.getInstance()
.getObjectWithUniqueColumn(UrunStok.class, "barkod",
us.getBarkod());
if (urunS == null) {
urunS = new UrunStok(us);
HibernateManager.getInstance().save(urunS);
} else {
urunS.setAdet(urunS.getAdet() + us.getAdet());
HibernateManager.getInstance().update(urunS);
}
}
}
@SuppressWarnings("unchecked")
protected void bekleyenSatisSecClicked() {
if (urunSatisListesi.size() > 0) {
AutoClosingMessageDialog
.showAutoClosingMessageDialog(
"Satış getirmek için satış listesini boşaltın veya bekletmeye alınız.",
2);
}
urunSatisListesi = (List<UrunSatis>) HibernateManager.getInstance()
.getEntitysList(bekleyenSatis, "satisListesi");
cTableSatisListesi.setObjects(urunSatisListesi);
vadeFark = !bekleyenSatis.getVade();
vadeUygulaClicked();
if (bekleyenSatis.getIskontoMiktari() == 0) {
cTextFieldIskontoTL.setText("");
} else {
cTextFieldIskontoTL.setText(String.valueOf(bekleyenSatis
.getIskontoMiktari()));
}
if (bekleyenSatis.getIskontoYuzde().equals("")) {
cTextFieldIskontoYuzde.setText("");
} else {
cTextFieldIskontoYuzde.setText(bekleyenSatis.getIskontoYuzde());
}
cLabelTaksitFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(bekleyenSatis.getTutar()));
if (!bekleyenSatis.getPersonel().equals("-")) {
for (int i = 0; i < cComboBoxPersonelPrim.getItemCount(); i++) {
if (bekleyenSatis.getPersonel().equals(
cComboBoxPersonelPrim.getItemAt(i).toString())) {
cComboBoxPersonelPrim.setSelectedIndex(i);
break;
}
}
} else {
cComboBoxPersonelPrim.setSelectedIndex(0);
}
cComboBoxPersonelPrim.updateUI();
if (!bekleyenSatis.getMusteri().equals("-")) {
cTextFieldMusteriSec.setText("MÜŞTERİ : "
+ bekleyenSatis.getMusteri());
} else {
cTextFieldMusteriSec.setText("Müşteri Seçiniz");
}
HibernateManager.getInstance().delete(bekleyenSatis);
}
protected void satisBekletmeClicked() {
SatisBilgi sb = new SatisBilgi(instance);
String satisKod = sb.showDialog();
if (satisKod != null) {
BekleyenSatis bs = new BekleyenSatis(satisKod);
bs = getBekleyenSatisInfo(bs, 0);
boolean check = HibernateManager.getInstance().save(bs);
if (check) {
AutoClosingMessageDialog.showAutoClosingMessageDialog("Satis "
+ satisKod + " adı ile beklemeye alınmıştır.", 2);
getDefaultValue();
}
}
}
private BekleyenSatis getBekleyenSatisInfo(BekleyenSatis bs, int state) {
if (cTextFieldIskontoTL.getText().equals("")) {
bs.setIskontoMiktari(0);
} else {
bs.setIskontoMiktari(Double.parseDouble(cTextFieldIskontoTL
.getText()));
}
if (cTextFieldIskontoYuzde.getText().equals("")) {
bs.setIskontoYuzde("");
} else {
bs.setIskontoYuzde(cTextFieldIskontoYuzde.getText());
}
bs.setVade(vadeFark);
bs.setKdvMiktari(kdvToplam);
if (!cTextFieldIskontoTL.getText().equals("")) {
bs.setTutar(pesinToplam
- Double.parseDouble(cTextFieldIskontoTL.getText()));
} else {
bs.setTutar(pesinToplam);
}
bs.setTarih(new Date());
if (cComboBoxPersonelPrim.getSelectedItem() != null) {
if (cComboBoxPersonelPrim.getSelectedIndex() != 0) {
personel = (Personel) cComboBoxPersonelPrim.getSelectedItem();
bs.setPersonel(cComboBoxPersonelPrim.getSelectedItem()
.toString());
bs.setPersonelPrimOrani(personel.getPrimOrani());
} else {
bs.setPersonel("-");
}
}
if (!cTextFieldMusteriSec.getText().equals("Müşteri Seçiniz")) {
bs.setMusteri(musteriBilgi);
}
for (int i = 0; i < urunSatisListesi.size(); i++) {
urunSatis = urunSatisListesi.get(i);
urunSatis.setYapilanSatis(false);
HibernateManager.getInstance().save(urunSatis);
}
bs.setSatisListesi(urunSatisListesi);
return bs;
}
protected void vadeUygulaClicked() {
if (vadeFark == false) {
vadeFark = true;
JButtonVadeUygula.setText("VADE FARKINI KALDIR (F5)");
taksitliFiyatDoldur();
} else {
vadeFark = false;
JButtonVadeUygula.setText("VADE FARKI UYGULA (F5)");
pesinFiyatDoldur();
}
for (int i = 0; i < urunSatisListesi.size(); i++) {
urunSatisListesi.get(i).isVade(vadeFark);
urunSatisListesi.get(i).getTutar();
}
cTableSatisListesi.setObjects(urunSatisListesi);
cTextFieldIskontoTL.setText("");
cTextFieldIskontoYuzde.setText("");
cTextFieldBarkodVeyaMiktar.requestFocus();
}
protected void kullaniciBilgiClicked() {
PSAKullaniciEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
protected void personelBilgiClicked() {
PSAPersonelEkrani.getInstance(0).setVisible(true);
instance.setEnabled(false);
}
protected void kullaniciTakipClicked() {
PSAKullaniciTakipEkrani.getInstance().setVisible(true);
setEnabled(false);
}
protected void kasaButtonClicked() {
DatabaseConnection.databaseConnect();
PSAKasaEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
protected void iadeButtonClicked() {
DatabaseConnection.databaseConnect();
PSAIadeEkrani.getInstance(0).setVisible(true);
setEnabled(false);
}
@SuppressWarnings("unchecked")
protected void krediKartButtonClicked(String tur) {
yapilanSatis = new YapilanSatis();
if (cTableSatisListesi.getRowCount() > 0) {
List<BankaPOSBilgileri> posBilgileri = (List<BankaPOSBilgileri>) HibernateManager
.getInstance().get(BankaPOSBilgileri.class, false);
if (posBilgileri.size() <= 0) {
Utils.showMessage("POS bilgisi bulunmamaktadır !");
return;
}
if (tur.equals(KREDI_KART)) {
kpSatisYap(yapilanSatis, KREDI_KART);
PSAKrediKartiOdeme.getInstance(yapilanSatis, urunSatisListesi)
.setVisible(true);
} else if (tur.equals(PARCALI_ODEME)) {
kpSatisYap(yapilanSatis, PARCALI_ODEME);
PSAParcaliOdemeEkrani.getInstance(0, yapilanSatis,
urunSatisListesi, null, null, 0.0).setVisible(true);
}
setEnabled(false);
cTextFieldBarkodVeyaMiktar.requestFocus();
} else {
Utils.showMessage("Satış listesinde ürün bulunmamaktadır.");
}
}
protected void nakitButtonClicked() {
yapilanSatis = new YapilanSatis();
if (cTableSatisListesi.getRowCount() > 0) {
satisYap(yapilanSatis, NAKİT);
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Nakit satış işlemi başarı ile tamamlanmıştır.", 2);
getDefaultValue();
} else {
Utils.showMessage("Satış listesinde ürün bulunmamaktadır.");
}
cTextFieldBarkodVeyaMiktar.requestFocus();
}
protected void detayliAramaClicked() {
DatabaseConnection.databaseConnect();
PSADetayliArama.getInstance().setVisible(true);
instance.setEnabled(false);
}
protected void vadeFarkControl() {
if (vadeFark == false) {
pesinFiyatDoldur();
} else {
taksitliFiyatDoldur();
}
cTextFieldIskontoTL.setText("");
cTextFieldIskontoYuzde.setText("");
}
protected boolean urunPermissionControl() {
if (stokControl == false) {
Utils.showMessage("Ürün silme ve güncelleme işlemi için izniniz bulunmamaktadır.");
return false;
}
if (cTableSatisListesi.getRowCount() > 0
|| cTablePanelBekleyenSatis.getTable().getRowCount() > 0) {
Utils.showMessage("Ürün güncelleme için satış listesinin boş olması gerekmektedir.");
return false;
}
return true;
}
protected boolean urunSevkPermissionControl() {
if (sevkControl == false) {
Utils.showMessage("Ürün sevk işlemi için izniniz bulunmamaktadır.");
return false;
}
return true;
}
protected void keyListenerAction(int keyCode) {
switch (keyCode) {
case KeyEvent.VK_F1:
JButtonIade.doClick();
break;
case KeyEvent.VK_F2:
JButtonNakit.doClick();
break;
case KeyEvent.VK_F3:
JButtonKrediKart.doClick();
break;
case KeyEvent.VK_F4:
jBUttonParcaliOdeme.doClick();
break;
case KeyEvent.VK_F5:
JButtonVadeUygula.doClick();
break;
}
}
protected static void getDefaultValue() {
pesinToplam = 0;
kdvToplam = 0;
cLabelPesinFiyatBilgi.setText("0.00");
cLabelTaksitFiyatBilgi.setText("0.00");
cLabelToplamKDVBilgi.setText("0.00");
cTextFieldIskontoTL.setText("");
cTextFieldIskontoYuzde.setText("");
cTextFieldMusteriSec.setText(MUSTERI_DEFAULT_VALUE);
cComboBoxPersonelPrim.setSelectedIndex(0);
cComboBoxPersonelPrim.updateUI();
JButtonVadeUygula.setText("VADE FARKI UYGULA (F5)");
vadeFark = false;
urunSatisListesi.clear();
satilanUrunListesi.clear();
cTableSatisListesi.setObjects(urunSatisListesi);
}
protected void urunTablePopupMenu(MouseEvent e) {
if (e.isPopupTrigger()) {
Point p = e.getPoint();
int rowNumber = cTablePanelUrun.getTable().rowAtPoint(p);
ListSelectionModel model = cTablePanelUrun.getTable()
.getSelectionModel();
model.setSelectionInterval(rowNumber, rowNumber);
pUrunMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
protected void enterClicked() {
if (cTextFieldBarkodVeyaMiktar.getText().equals("")) {
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Lütfen barkod numarısı giriniz.", 2);
cTextFieldBarkodVeyaMiktar.requestFocus();
return;
}
int urunAdet;
String urunBarkod = null;
String[] bilgi;
bilgi = barkodVeMiktar(cTextFieldBarkodVeyaMiktar.getText());
if (bilgi.length > 1) {
urunAdet = Integer.valueOf(bilgi[0]);
urunBarkod = bilgi[1];
} else {
urunBarkod = bilgi[0];
urunAdet = 1;
}
if (urunAdet == 0) {
AutoClosingMessageDialog.showAutoClosingMessageDialog(
"Yanlış adet bilgisi (0).", 2);
cTextFieldBarkodVeyaMiktar.setText("");
cTextFieldBarkodVeyaMiktar.requestFocus();
return;
}
UrunStok urun = (UrunStok) HibernateManager.getInstance()
.getObjectWithUniqueColumn(UrunStok.class, "barkod",
Long.parseLong(urunBarkod));
if (urun != null) {
if (urun.getAdet() >= urunAdet) {
if (urunSatisControl(urun)) {
urunSatis = new UrunSatis(urun, urunAdet);
urunSatis.isVade(vadeFark);
urunSatis.getTutar();
urunSatis.getVadesizKDVTutar();
urunSatis.getVadeliKDVTutar();
urunSatisListesi.add(urunSatis);
} else {
urunSatis = findUrunSatis(urun);
if (urun.getAdet() >= urunAdet) {
urunSatis.setAdet(urunSatis.getAdet() + urunAdet);
urunSatis.getTutar();
urunSatis.getVadesizKDVTutar();
urunSatis.getVadeliKDVTutar();
} else {
Utils.showMessage("Sistemde yeteri kadar ürün bulunmamaktadır.");
}
}
urun.setAdet(urun.getAdet() - urunAdet);
HibernateManager.getInstance().update(urun);
cTextFieldBarkodVeyaMiktar.setText("");
cTableSatisListesi.setObjects(urunSatisListesi);
SoundUtil.playSound();
vadeFarkControl();
} else {
Utils.showMessage("Sistemde yeteri kadar ürün bulunmamaktadır.");
cTextFieldBarkodVeyaMiktar.setText("");
}
} else {
Utils.showMessage("Sistemde barkod numarası " + urunBarkod
+ " olan ürün bulunmamaktadır.");
cTextFieldBarkodVeyaMiktar.setText("");
}
cTextFieldBarkodVeyaMiktar.requestFocus();
}
protected void urunSatisClicked() {
cTextFieldBarkodVeyaMiktar.setText(String.valueOf(urun.getBarkod()));
jTabbedPaneAnaEkran.setSelectedIndex(0);
}
private void satisYap(YapilanSatis satis2, String odemeTur) {
HibernateManager.getInstance().save(satis2);
if (cTextFieldIskontoTL.getText().equals("")) {
satis2.setIskontoMiktari(0.00);
} else {
satis2.setIskontoMiktari(Double.parseDouble(cTextFieldIskontoTL
.getText()));
}
satis2.setVade(vadeFark);
satis2.setKdvMiktari(kdvToplam);
satis2.setOdemeTur(odemeTur);
satis2.setTarih(new Date());
odemeBilgisi = new OdemeBilgileri();
odemeBilgisi.setSystemName(HibernateManager.getInstance()
.getSystemName());
odemeBilgisi.setNakitTutar(pesinToplam);
satis2.setOdemeBilgisi(odemeBilgisi);
satis2.setTutar(pesinToplam);
for (int i = 0; i < urunSatisListesi.size(); i++) {
urunSatis = urunSatisListesi.get(i);
urunSatis.setSystemName(HibernateManager.getInstance()
.getSystemName());
urunSatis.setSatisId(satis2.getId());
urunSatis.setTarih(satis2.getTarih());
urunSatis.setYapilanSatis(true);
satilanUrunListesi.add(urunSatis);
HibernateManager.getInstance().save(urunSatis);
}
if (cComboBoxPersonelPrim.getSelectedItem() != null) {
if (cComboBoxPersonelPrim.getSelectedIndex() != 0) {
personel = (Personel) cComboBoxPersonelPrim.getSelectedItem();
satis2.setPersonel(cComboBoxPersonelPrim.getSelectedItem()
.toString());
satis2.setPersonelPrimOrani(personel.getPrimOrani());
} else {
satis2.setPersonel("-");
}
}
if (!cTextFieldMusteriSec.getText().equals("Müşteri Seçiniz")) {
satis2.setMusteri(musteriBilgi);
}
satis2.setSatisListesi(satilanUrunListesi);
HibernateManager.getInstance().update(satis2);
}
private void kpSatisYap(YapilanSatis satis2, String odemeTur) {
if (cTextFieldIskontoTL.getText().equals("")) {
satis2.setIskontoMiktari(0.00);
} else {
satis2.setIskontoMiktari(Double.parseDouble(cTextFieldIskontoTL
.getText()));
}
satis2.setVade(vadeFark);
satis2.setKdvMiktari(kdvToplam);
satis2.setOdemeTur(odemeTur);
satis2.setTarih(new Date());
satis2.setTutar(pesinToplam);
if (cComboBoxPersonelPrim.getSelectedItem() != null) {
if (cComboBoxPersonelPrim.getSelectedIndex() != 0) {
personel = (Personel) cComboBoxPersonelPrim.getSelectedItem();
satis2.setPersonel(cComboBoxPersonelPrim.getSelectedItem()
.toString());
satis2.setPersonelPrimOrani(personel.getPrimOrani());
} else {
satis2.setPersonel("-");
}
}
if (!cTextFieldMusteriSec.getText().equals("Müşteri Seçiniz")) {
satis2.setMusteri(musteriBilgi);
}
}
private static void pesinFiyatDoldur() {
cLabelPesinFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(cLabelFiyatBilgiDoldur("PESİN")));
cLabelTaksitFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(cLabelFiyatBilgiDoldur("PESİN")));
cLabelToplamKDVBilgi.setText(Utils.DECIMAL_FORMAT
.format(cLabelToplamKDVBilgiDoldur("KDV")));
}
private static void taksitliFiyatDoldur() {
cLabelPesinFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(cLabelFiyatBilgiDoldur("TAKSİTLİ")));
cLabelTaksitFiyatBilgi.setText(Utils.DECIMAL_FORMAT
.format(cLabelFiyatBilgiDoldur("TAKSİTLİ")));
cLabelToplamKDVBilgi.setText(Utils.DECIMAL_FORMAT
.format(cLabelToplamKDVBilgiDoldur("VadeliKDV")));
}
private static Double cLabelToplamKDVBilgiDoldur(String fiyatTip) {
kdvToplam = 0;
for (int i = 0; i < urunSatisListesi.size(); i++) {
if (fiyatTip.equals("KDV")) {
kdvToplam += urunSatisListesi.get(i).getVadesizKDVTutar();
} else {
kdvToplam += urunSatisListesi.get(i).getVadeliKDVTutar();
}
}
String kdvTutar;
String[] fiyat = decimalControl(String.valueOf(kdvToplam));
if (fiyat[1].length() > 1) {
if (fiyat[1].length() > 2) {
if (Integer.parseInt(fiyat[1].substring(2, 3)) > 5) {
kdvTutar = fiyat[0]
+ "."
+ String.valueOf(Integer.parseInt(fiyat[1]
.substring(0, 2)) + 1);
} else {
kdvTutar = fiyat[0] + "." + fiyat[1].substring(0, 2);
}
} else {
kdvTutar = fiyat[0] + "." + fiyat[1].substring(0, 2);
}
} else {
kdvTutar = fiyat[0] + "." + fiyat[1].substring(0, 1) + "0";
}
kdvToplam = Double.parseDouble(kdvTutar);
return kdvToplam;
}
private static Double cLabelFiyatBilgiDoldur(String fiyatTip) {
pesinToplam = 0;
for (int i = 0; i < urunSatisListesi.size(); i++) {
if (fiyatTip.equals("PESİN")) {
pesinToplam += urunSatisListesi.get(i).getVadesizTutar();
} else {
pesinToplam += urunSatisListesi.get(i).getVadeliTutar();
}
}
return pesinToplam;
}
protected UrunSatis findUrunSatis(UrunStok urun) {
UrunSatis us = new UrunSatis();
for (int i = 0; i < urunSatisListesi.size(); i++) {
if (String.valueOf(urun.getBarkod()).equals(
String.valueOf(urunSatisListesi.get(i).getBarkod()))) {
us = urunSatisListesi.get(i);
break;
}
}
return us;
}
private boolean urunSatisControl(UrunStok urun) {
boolean control = true;
for (int i = 0; i < urunSatisListesi.size(); i++) {
if (String.valueOf(urun.getBarkod()).equals(
String.valueOf(urunSatisListesi.get(i).getBarkod()))) {
control = false;
break;
}
}
return control;
}
private static void cikisButtonClicked(int state) {
int selectedOption = JOptionPane.showOptionDialog(null,
"Sistemden çıkmak istediğinizden emin misiniz?",
"SİSTEM UYARISI", JOptionPane.OK_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, null, new String[] { "EVET",
"HAYIR" }, "default");
if (selectedOption == JOptionPane.OK_OPTION) {
controlInitialValue();
kullaniciTakip.setCikisSaat(new Date());
HibernateManager.getInstance().save(kullaniciTakip);
HibernateManager.getInstance().saveEntityObject(kullaniciT,
"kullaniciTakipListesi", kullaniciTakip);
if (state == 1) {
instance.setDefaultCloseOperation(EXIT_ON_CLOSE);
} else {
instance.dispose();
PSAGirisSayfasi.getInstance().setVisible(true);
}
} else {
instance.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
}
}
private static void controlInitialValue() {
sevkControl = true;
}
private static void getVal(String iskonto, double iskontoluFiyat,
String durum) {
String[] fiyat;
String toplamFiyat = "";
if (durum.equals("iskontoTL")) {
fiyat = decimalControl(String.valueOf(iskontoluFiyat));
if (fiyat[1].length() > 1) {
if (fiyat[1].length() > 2) {
if (Integer.parseInt(fiyat[1].substring(2, 3)) > 5) {
toplamFiyat = fiyat[0]
+ "."
+ String.valueOf(Integer.parseInt(fiyat[1]
.substring(0, 2)) + 1);
} else {
toplamFiyat = fiyat[0] + "." + fiyat[1].substring(0, 2);
}
} else {
toplamFiyat = fiyat[0] + "." + fiyat[1].substring(0, 2);
}
} else {
toplamFiyat = fiyat[0] + "." + fiyat[1].substring(0, 1) + "0";
}
cTextFieldIskontoYuzde.setText(iskonto);
} else {
fiyat = decimalControl(String.valueOf(iskontoluFiyat));
if (fiyat[1].length() > 1) {
if (fiyat[1].length() > 2) {
if (Integer.parseInt(fiyat[1].substring(2, 3)) > 5) {
toplamFiyat = fiyat[0]
+ "."
+ String.valueOf(Integer.parseInt(fiyat[1]
.substring(0, 2)) + 1);
} else {
toplamFiyat = fiyat[0] + "." + fiyat[1].substring(0, 2);
}
} else {
toplamFiyat = fiyat[0] + "." + fiyat[1].substring(0, 2);
}
} else {
toplamFiyat = fiyat[0] + "." + fiyat[1].substring(0, 1) + "0";
}
cTextFieldIskontoTL.setText(iskonto);
}
cLabelTaksitFiyatBilgi.setText(Utils.DECIMAL_FORMAT.format(Double
.parseDouble(toplamFiyat)));
}
private static String[] decimalControl(String valueOf) {
String[] parts = valueOf.split("\\.");
return parts;
}
private static String[] barkodVeMiktar(String barkod) {
String[] parts = null;
if (barkod.length() <= 0) {
return parts;
}
parts = barkod.split("\\*");
return parts;
}
}