Package gui

Source Code of gui.PSAAnalizPanel

package gui;

import hibernateSwingApi.component.CComboBox;
import hibernateSwingApi.component.CTable;
import hibernateSwingApi.component.CTextField;
import hibernateSwingApi.hibernate.HibernateManager;
import hibernateSwingApi.utils.Utils;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;

import org.hibernate.Query;
import org.hibernate.Session;

import pojos.Firma;
import pojos.Renk;
import pojos.UrunBeden;
import pojos.UrunCinsiyet;
import pojos.UrunGrup;
import pojos.UrunMarka;
import pojos.UrunModel;
import pojos.UrunSatis;
import pojos.UrunSatisKasa;
import pojos.UrunSezon;
import pojos.UrunStok;
import pojos.UrunStokDetayliArama;
import service.AutoClosingMessageDialog;
import service.PSAUtil;

import com.toedter.calendar.JDateChooser;

public class PSAAnalizPanel {

  /**
   * @wbp.parser.entryPoint
   */

  private static PSAAnalizPanel instance;
  private CTextField jTextFieldBarkod;
  private JPanel jPanelAnaliz;
  private JPanel jPanelKisit;
  private JLabel jLabelAramaKisitlari;
  private JLabel jLabelStokTablosu;
  private JLabel jLabelBarkod;
  private JLabel jLabelSezon;
  private JLabel jLabelGrup;
  private JLabel jLabelModel;
  private JLabel jLabelBeden;
  private JLabel jLabelRenk;
  private JLabel jLabelCinsiyet;
  private CComboBox<UrunSezon> jComboBoxSezon;
  private CComboBox<UrunGrup> jComboBoxGrup;
  private CComboBox<UrunModel> jComboBoxModel;
  private CComboBox<UrunBeden> jComboBoxBeden;
  private CTextField jTextFieldRenk;
  private JLabel jLabelMarka;
  private CComboBox<UrunCinsiyet> jComboBoxCinsiyet;
  private CComboBox<UrunMarka> jComboBoxMarka;
  private JLabel jLabelFirma;
  private CComboBox<Firma> jComboBoxFirma;
  private JScrollPane scrollPaneStok;
  private CTable cTableStok;
  private JLabel jLabelSatisTablosu;
  private JScrollPane scrollPaneSatis;
  private CTable cTableSatis;
  private JButton jButtonAra;
  private JPanel jPanelStokVeriler;
  private JLabel jLabelStokVeriler;
  private JLabel jLabelAlisFiyat;
  private JLabel jLabelAlisFiyatBilgi;
  private JLabel tl_1;
  private JLabel jLabelPesinFiyat;
  private JLabel jLabelPesinFiyatBilgi;
  private JLabel tl_2;
  private JLabel jLabelTaksitliFiyat;
  private JLabel jLabelTaksitliFiyatBilgi;
  private JLabel tl_3;
  private JLabel jLabelStokTabloGrup;
  private JLabel jLabelUrunStokAdet;
  private JLabel adet_1;
  private JLabel jLabelStokTabloAdet;
  private JLabel jLabelStokTabloAdetBilgi;
  private JLabel adet_2;
  private JPanel jPanelSatisVeriler;
  private JLabel jLabelSatisVeriler;
  private JLabel jLabelPesinSatis;
  private JLabel jLabelPesinSatisBilgi;
  private JLabel tl_4;
  private JLabel jLabelTaksitliSatis;
  private JLabel jLabelTaksitliSatisBilgi;
  private JLabel tl_5;
  private JLabel jLabelSatisTabloGrup;
  private JLabel jLabelSatisTabloGrupBilgi;
  private JLabel adet_3;
  private JLabel jLabelSatisTabloAdet;
  private JLabel jLabelSatisTabloAdetBilgi;
  private JLabel adet_4;
  private List<UrunStok> urunStokListesi;
  private List<UrunSatis> urunSatisListesi;
  private List<UrunStokDetayliArama> urunStokDetayListesi;
  private Renk secilenRenk = null;
  private JDateChooser jDateChooserIlkTarih;
  private JDateChooser jDateChooserSonTarih;
  private int andGirildimi = 0;

  private static final String DEFAULT_COMBOBOX_VALUE = "Seçiniz";
  private static final String ALL_COMBOBOX_VALUE = "TÜMÜ";
  private static final String COMBOBOX_VALUE = "Şube seçiniz";

  public static PSAAnalizPanel getInstance(JDateChooser ilkTarih,
      JDateChooser sonTarih) {
    instance = new PSAAnalizPanel(ilkTarih, sonTarih);

    return instance;
  }

  public PSAAnalizPanel(JDateChooser ilkTarih, JDateChooser sonTarih) {
    jDateChooserIlkTarih = ilkTarih;
    jDateChooserSonTarih = sonTarih;
  }

  /**
   * @wbp.parser.entryPoint
   */

  public JPanel getAnalizPanel() {

    jPanelAnaliz = new JPanel();
    jPanelAnaliz.setBorder(new EmptyBorder(5, 5, 5, 5));
    GridBagConstraints gbc_jPanelAnaliz = new GridBagConstraints();
    gbc_jPanelAnaliz.fill = GridBagConstraints.BOTH;
    gbc_jPanelAnaliz.gridx = 0;
    gbc_jPanelAnaliz.gridy = 1;
    GridBagLayout gbl_jPanelAnaliz = new GridBagLayout();
    gbl_jPanelAnaliz.columnWidths = new int[] { 266, 350, 350, 0 };
    gbl_jPanelAnaliz.rowHeights = new int[] { 20, 159, 20, 159, 80, 50, 0 };
    gbl_jPanelAnaliz.columnWeights = new double[] { 0.0, 1.0, 1.0,
        Double.MIN_VALUE };
    gbl_jPanelAnaliz.rowWeights = new double[] { 0.0, 1.0, 0.0, 1.0, 1.0,
        1.0, Double.MIN_VALUE };
    jPanelAnaliz.setLayout(gbl_jPanelAnaliz);

    jLabelAramaKisitlari = new JLabel();
    jLabelAramaKisitlari.setText("ARAMA KISITLARI");
    jLabelAramaKisitlari.setHorizontalAlignment(SwingConstants.CENTER);
    jLabelAramaKisitlari.setFont(new Font("Tahoma", Font.BOLD, 16));
    GridBagConstraints gbc_jLabelAramaKisitlari = new GridBagConstraints();
    gbc_jLabelAramaKisitlari.anchor = GridBagConstraints.NORTH;
    gbc_jLabelAramaKisitlari.fill = GridBagConstraints.HORIZONTAL;
    gbc_jLabelAramaKisitlari.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelAramaKisitlari.gridx = 0;
    gbc_jLabelAramaKisitlari.gridy = 0;
    jPanelAnaliz.add(jLabelAramaKisitlari, gbc_jLabelAramaKisitlari);

    jLabelStokTablosu = new JLabel();
    jLabelStokTablosu.setText("STOK TABLOSU");
    jLabelStokTablosu.setHorizontalAlignment(SwingConstants.CENTER);
    jLabelStokTablosu.setFont(new Font("Tahoma", Font.BOLD, 16));
    GridBagConstraints gbc_jLabelStokTablosu = new GridBagConstraints();
    gbc_jLabelStokTablosu.anchor = GridBagConstraints.NORTH;
    gbc_jLabelStokTablosu.fill = GridBagConstraints.HORIZONTAL;
    gbc_jLabelStokTablosu.insets = new Insets(0, 0, 5, 0);
    gbc_jLabelStokTablosu.gridwidth = 2;
    gbc_jLabelStokTablosu.gridx = 1;
    gbc_jLabelStokTablosu.gridy = 0;
    jPanelAnaliz.add(jLabelStokTablosu, gbc_jLabelStokTablosu);

    jPanelKisit = new JPanel();
    jPanelKisit.setBorder(new LineBorder(new Color(0, 0, 0), 2));
    jPanelKisit.setBackground(SystemColor.controlShadow);
    GridBagConstraints gbc_jPanelKisit = new GridBagConstraints();
    gbc_jPanelKisit.fill = GridBagConstraints.BOTH;
    gbc_jPanelKisit.insets = new Insets(0, 0, 5, 5);
    gbc_jPanelKisit.gridheight = 4;
    gbc_jPanelKisit.gridx = 0;
    gbc_jPanelKisit.gridy = 1;
    jPanelAnaliz.add(jPanelKisit, gbc_jPanelKisit);
    GridBagLayout gbl_jPanelKisit = new GridBagLayout();
    gbl_jPanelKisit.columnWidths = new int[] { 0, 200, 0 };
    gbl_jPanelKisit.rowHeights = new int[] { 0, 20, 20, 20, 20, 21, 22, 20,
        20, 0 };
    gbl_jPanelKisit.columnWeights = new double[] { 0.0, 1.0,
        Double.MIN_VALUE };
    gbl_jPanelKisit.rowWeights = new double[] { 1.0, 1.0, 1.0, 1.0, 1.0,
        1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE };
    jPanelKisit.setLayout(gbl_jPanelKisit);

    jLabelBarkod = new JLabel();
    jLabelBarkod.setText("Barkodu");
    jLabelBarkod.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelBarkod = new GridBagConstraints();
    gbc_jLabelBarkod.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelBarkod.anchor = GridBagConstraints.EAST;
    gbc_jLabelBarkod.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelBarkod.gridx = 0;
    gbc_jLabelBarkod.gridy = 0;
    jPanelKisit.add(jLabelBarkod, gbc_jLabelBarkod);

    jTextFieldBarkod = new CTextField();
    GridBagConstraints gbc_jTextFieldBarkod = new GridBagConstraints();
    gbc_jTextFieldBarkod.insets = new Insets(0, 0, 5, 0);
    gbc_jTextFieldBarkod.fill = GridBagConstraints.BOTH;
    gbc_jTextFieldBarkod.gridx = 1;
    gbc_jTextFieldBarkod.gridy = 0;
    jPanelKisit.add(jTextFieldBarkod, gbc_jTextFieldBarkod);
    jTextFieldBarkod.setColumns(10);
    jTextFieldBarkod.setAsOnlyNumberTextField();

    jLabelSezon = new JLabel();
    jLabelSezon.setText("Sezonu");
    jLabelSezon.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelSezon = new GridBagConstraints();
    gbc_jLabelSezon.anchor = GridBagConstraints.WEST;
    gbc_jLabelSezon.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelSezon.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelSezon.gridx = 0;
    gbc_jLabelSezon.gridy = 1;
    jPanelKisit.add(jLabelSezon, gbc_jLabelSezon);

    jComboBoxSezon = new CComboBox<UrunSezon>(UrunSezon.class);
    GridBagConstraints gbc_jComboBoxSezon = new GridBagConstraints();
    gbc_jComboBoxSezon.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxSezon.insets = new Insets(0, 0, 5, 0);
    gbc_jComboBoxSezon.gridx = 1;
    gbc_jComboBoxSezon.gridy = 1;
    jPanelKisit.add(jComboBoxSezon, gbc_jComboBoxSezon);

    jLabelGrup = new JLabel();
    jLabelGrup.setText("Grubu");
    jLabelGrup.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelGrup = new GridBagConstraints();
    gbc_jLabelGrup.anchor = GridBagConstraints.WEST;
    gbc_jLabelGrup.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelGrup.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelGrup.gridx = 0;
    gbc_jLabelGrup.gridy = 2;
    jPanelKisit.add(jLabelGrup, gbc_jLabelGrup);

    jComboBoxGrup = new CComboBox<UrunGrup>(UrunGrup.class);
    GridBagConstraints gbc_jComboBoxGrup = new GridBagConstraints();
    gbc_jComboBoxGrup.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxGrup.insets = new Insets(0, 0, 5, 0);
    gbc_jComboBoxGrup.gridx = 1;
    gbc_jComboBoxGrup.gridy = 2;
    jPanelKisit.add(jComboBoxGrup, gbc_jComboBoxGrup);

    jLabelModel = new JLabel();
    jLabelModel.setText("Modeli");
    jLabelModel.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelModel = new GridBagConstraints();
    gbc_jLabelModel.anchor = GridBagConstraints.WEST;
    gbc_jLabelModel.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelModel.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelModel.gridx = 0;
    gbc_jLabelModel.gridy = 3;
    jPanelKisit.add(jLabelModel, gbc_jLabelModel);

    jComboBoxModel = new CComboBox<UrunModel>(UrunModel.class);
    GridBagConstraints gbc_jComboBoxModel = new GridBagConstraints();
    gbc_jComboBoxModel.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxModel.insets = new Insets(0, 0, 5, 0);
    gbc_jComboBoxModel.gridx = 1;
    gbc_jComboBoxModel.gridy = 3;
    jPanelKisit.add(jComboBoxModel, gbc_jComboBoxModel);

    jLabelBeden = new JLabel();
    jLabelBeden.setText("Bedeni");
    jLabelBeden.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelBeden = new GridBagConstraints();
    gbc_jLabelBeden.anchor = GridBagConstraints.WEST;
    gbc_jLabelBeden.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelBeden.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelBeden.gridx = 0;
    gbc_jLabelBeden.gridy = 4;
    jPanelKisit.add(jLabelBeden, gbc_jLabelBeden);

    jComboBoxBeden = new CComboBox<UrunBeden>(UrunBeden.class);
    GridBagConstraints gbc_jComboBoxBeden = new GridBagConstraints();
    gbc_jComboBoxBeden.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxBeden.insets = new Insets(0, 0, 5, 0);
    gbc_jComboBoxBeden.gridx = 1;
    gbc_jComboBoxBeden.gridy = 4;
    jPanelKisit.add(jComboBoxBeden, gbc_jComboBoxBeden);

    jLabelRenk = new JLabel();
    jLabelRenk.setText("Rengi");
    jLabelRenk.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelRenk = new GridBagConstraints();
    gbc_jLabelRenk.anchor = GridBagConstraints.WEST;
    gbc_jLabelRenk.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelRenk.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelRenk.gridx = 0;
    gbc_jLabelRenk.gridy = 5;
    jPanelKisit.add(jLabelRenk, gbc_jLabelRenk);

    jTextFieldRenk = new CTextField(30);
    jTextFieldRenk.setText("RENK YOK");
    jTextFieldRenk.setHorizontalAlignment(SwingConstants.CENTER);
    jTextFieldRenk.setForeground(Color.BLACK);
    jTextFieldRenk.setEditable(false);
    jTextFieldRenk.setBackground(Color.WHITE);
    GridBagConstraints gbc_jTextFieldRenk = new GridBagConstraints();
    gbc_jTextFieldRenk.fill = GridBagConstraints.BOTH;
    gbc_jTextFieldRenk.insets = new Insets(0, 0, 5, 0);
    gbc_jTextFieldRenk.gridx = 1;
    gbc_jTextFieldRenk.gridy = 5;
    jPanelKisit.add(jTextFieldRenk, gbc_jTextFieldRenk);

    jLabelCinsiyet = new JLabel();
    jLabelCinsiyet.setText("Cinsiyeti");
    jLabelCinsiyet.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelCinsiyet = new GridBagConstraints();
    gbc_jLabelCinsiyet.anchor = GridBagConstraints.WEST;
    gbc_jLabelCinsiyet.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelCinsiyet.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelCinsiyet.gridx = 0;
    gbc_jLabelCinsiyet.gridy = 6;
    jPanelKisit.add(jLabelCinsiyet, gbc_jLabelCinsiyet);

    jComboBoxCinsiyet = new CComboBox<UrunCinsiyet>(UrunCinsiyet.class);
    jComboBoxCinsiyet.setSelectedIndex(-1);
    GridBagConstraints gbc_jComboBoxCinsiyet = new GridBagConstraints();
    gbc_jComboBoxCinsiyet.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxCinsiyet.insets = new Insets(0, 0, 5, 0);
    gbc_jComboBoxCinsiyet.gridx = 1;
    gbc_jComboBoxCinsiyet.gridy = 6;
    jPanelKisit.add(jComboBoxCinsiyet, gbc_jComboBoxCinsiyet);

    jLabelMarka = new JLabel();
    jLabelMarka.setText("Markası");
    jLabelMarka.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelMarka = new GridBagConstraints();
    gbc_jLabelMarka.anchor = GridBagConstraints.WEST;
    gbc_jLabelMarka.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelMarka.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelMarka.gridx = 0;
    gbc_jLabelMarka.gridy = 7;
    jPanelKisit.add(jLabelMarka, gbc_jLabelMarka);

    jComboBoxMarka = new CComboBox<UrunMarka>(UrunMarka.class);
    jComboBoxMarka.setSelectedIndex(-1);
    GridBagConstraints gbc_jComboBoxMarka = new GridBagConstraints();
    gbc_jComboBoxMarka.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxMarka.insets = new Insets(0, 0, 5, 0);
    gbc_jComboBoxMarka.gridx = 1;
    gbc_jComboBoxMarka.gridy = 7;
    jPanelKisit.add(jComboBoxMarka, gbc_jComboBoxMarka);

    jLabelFirma = new JLabel();
    jLabelFirma.setText("Firma");
    jLabelFirma.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelFirma = new GridBagConstraints();
    gbc_jLabelFirma.anchor = GridBagConstraints.WEST;
    gbc_jLabelFirma.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelFirma.insets = new Insets(0, 0, 0, 5);
    gbc_jLabelFirma.gridx = 0;
    gbc_jLabelFirma.gridy = 8;
    jPanelKisit.add(jLabelFirma, gbc_jLabelFirma);

    jComboBoxFirma = new CComboBox<Firma>(Firma.class);
    jComboBoxFirma.setSelectedIndex(-1);
    GridBagConstraints gbc_jComboBoxFirma = new GridBagConstraints();
    gbc_jComboBoxFirma.fill = GridBagConstraints.BOTH;
    gbc_jComboBoxFirma.gridx = 1;
    gbc_jComboBoxFirma.gridy = 8;
    jPanelKisit.add(jComboBoxFirma, gbc_jComboBoxFirma);

    scrollPaneStok = new JScrollPane();
    GridBagConstraints gbc_scrollPaneStok = new GridBagConstraints();
    gbc_scrollPaneStok.fill = GridBagConstraints.BOTH;
    gbc_scrollPaneStok.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPaneStok.gridwidth = 2;
    gbc_scrollPaneStok.gridx = 1;
    gbc_scrollPaneStok.gridy = 1;
    jPanelAnaliz.add(scrollPaneStok, gbc_scrollPaneStok);

    cTableStok = new CTable((String) null, UrunStokDetayliArama.class);
    scrollPaneStok.setViewportView(cTableStok);

    jLabelSatisTablosu = new JLabel();
    jLabelSatisTablosu.setText("SATIŞ TABLOSU");
    jLabelSatisTablosu.setHorizontalAlignment(SwingConstants.CENTER);
    jLabelSatisTablosu.setFont(new Font("Tahoma", Font.BOLD, 16));
    GridBagConstraints gbc_jLabelSatisTablosu = new GridBagConstraints();
    gbc_jLabelSatisTablosu.anchor = GridBagConstraints.NORTH;
    gbc_jLabelSatisTablosu.fill = GridBagConstraints.HORIZONTAL;
    gbc_jLabelSatisTablosu.insets = new Insets(0, 0, 5, 0);
    gbc_jLabelSatisTablosu.gridwidth = 2;
    gbc_jLabelSatisTablosu.gridx = 1;
    gbc_jLabelSatisTablosu.gridy = 2;
    jPanelAnaliz.add(jLabelSatisTablosu, gbc_jLabelSatisTablosu);

    scrollPaneSatis = new JScrollPane();
    GridBagConstraints gbc_scrollPaneSatis = new GridBagConstraints();
    gbc_scrollPaneSatis.fill = GridBagConstraints.BOTH;
    gbc_scrollPaneSatis.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPaneSatis.gridwidth = 2;
    gbc_scrollPaneSatis.gridx = 1;
    gbc_scrollPaneSatis.gridy = 3;
    jPanelAnaliz.add(scrollPaneSatis, gbc_scrollPaneSatis);

    cTableSatis = new CTable((String) null, UrunSatisKasa.class);
    scrollPaneSatis.setViewportView(cTableSatis);

    jButtonAra = new JButton();
    jButtonAra.setText("ARA");
    jButtonAra.setIcon(PSAUtil
        .getImageIconViaRelativePath("picture/detayliArama.png"));
    jButtonAra.setFont(new Font("Tahoma", Font.BOLD, 13));
    GridBagConstraints gbc_jButtonAra = new GridBagConstraints();
    gbc_jButtonAra.fill = GridBagConstraints.BOTH;
    gbc_jButtonAra.insets = new Insets(0, 0, 5, 5);
    gbc_jButtonAra.gridx = 0;
    gbc_jButtonAra.gridy = 5;
    jPanelAnaliz.add(jButtonAra, gbc_jButtonAra);

    jPanelStokVeriler = new JPanel();
    jPanelStokVeriler.setBorder(new LineBorder(new Color(0, 0, 0)));
    GridBagConstraints gbc_jPanelStokVeriler = new GridBagConstraints();
    gbc_jPanelStokVeriler.fill = GridBagConstraints.BOTH;
    gbc_jPanelStokVeriler.insets = new Insets(0, 0, 0, 5);
    gbc_jPanelStokVeriler.gridheight = 2;
    gbc_jPanelStokVeriler.gridx = 1;
    gbc_jPanelStokVeriler.gridy = 4;
    jPanelAnaliz.add(jPanelStokVeriler, gbc_jPanelStokVeriler);
    GridBagLayout gbl_jPanelStokVeriler = new GridBagLayout();
    gbl_jPanelStokVeriler.columnWidths = new int[] { 151, 31, 51 };
    gbl_jPanelStokVeriler.rowHeights = new int[] { 0, 30, 17, 17, 17, 20, 0 };
    gbl_jPanelStokVeriler.columnWeights = new double[] { 1.0, 0.0, 1.0 };
    gbl_jPanelStokVeriler.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0,
        1.0, 1.0, Double.MIN_VALUE };
    jPanelStokVeriler.setLayout(gbl_jPanelStokVeriler);

    jLabelStokVeriler = new JLabel("STOK TABLOSU VERİLERİ");
    jLabelStokVeriler.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelStokVeriler = new GridBagConstraints();
    gbc_jLabelStokVeriler.anchor = GridBagConstraints.NORTHWEST;
    gbc_jLabelStokVeriler.insets = new Insets(0, 0, 5, 0);
    gbc_jLabelStokVeriler.gridwidth = 3;
    gbc_jLabelStokVeriler.gridx = 0;
    gbc_jLabelStokVeriler.gridy = 0;
    jPanelStokVeriler.add(jLabelStokVeriler, gbc_jLabelStokVeriler);
    jLabelStokVeriler.setHorizontalAlignment(SwingConstants.CENTER);

    jLabelAlisFiyat = new JLabel();
    jLabelAlisFiyat.setText("Toplam alış fiyat");
    jLabelAlisFiyat.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelAlisFiyat = new GridBagConstraints();
    gbc_jLabelAlisFiyat.anchor = GridBagConstraints.WEST;
    gbc_jLabelAlisFiyat.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelAlisFiyat.gridx = 0;
    gbc_jLabelAlisFiyat.gridy = 1;
    jPanelStokVeriler.add(jLabelAlisFiyat, gbc_jLabelAlisFiyat);

    jLabelAlisFiyatBilgi = new JLabel();
    jLabelAlisFiyatBilgi.setText("0.00");
    jLabelAlisFiyatBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelAlisFiyatBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelAlisFiyatBilgi = new GridBagConstraints();
    gbc_jLabelAlisFiyatBilgi.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelAlisFiyatBilgi.gridx = 1;
    gbc_jLabelAlisFiyatBilgi.gridy = 1;
    jPanelStokVeriler.add(jLabelAlisFiyatBilgi, gbc_jLabelAlisFiyatBilgi);

    tl_1 = new JLabel();
    tl_1.setVerticalAlignment(SwingConstants.BOTTOM);
    tl_1.setText("TL");
    tl_1.setFont(new Font("Tahoma", Font.BOLD, 11));
    GridBagConstraints gbc_tl_1 = new GridBagConstraints();
    gbc_tl_1.anchor = GridBagConstraints.WEST;
    gbc_tl_1.insets = new Insets(0, 0, 5, 0);
    gbc_tl_1.gridx = 2;
    gbc_tl_1.gridy = 1;
    jPanelStokVeriler.add(tl_1, gbc_tl_1);

    jLabelPesinFiyat = new JLabel();
    GridBagConstraints gbc_jLabelPesinFiyat = new GridBagConstraints();
    gbc_jLabelPesinFiyat.anchor = GridBagConstraints.WEST;
    gbc_jLabelPesinFiyat.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelPesinFiyat.gridx = 0;
    gbc_jLabelPesinFiyat.gridy = 2;
    jPanelStokVeriler.add(jLabelPesinFiyat, gbc_jLabelPesinFiyat);
    jLabelPesinFiyat.setText("Toplam peşin fiyat");
    jLabelPesinFiyat.setFont(new Font("Tahoma", Font.BOLD, 14));

    jLabelPesinFiyatBilgi = new JLabel();
    GridBagConstraints gbc_jLabelPesinFiyatBilgi = new GridBagConstraints();
    gbc_jLabelPesinFiyatBilgi.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelPesinFiyatBilgi.gridx = 1;
    gbc_jLabelPesinFiyatBilgi.gridy = 2;
    jPanelStokVeriler.add(jLabelPesinFiyatBilgi, gbc_jLabelPesinFiyatBilgi);
    jLabelPesinFiyatBilgi.setText("0.00");
    jLabelPesinFiyatBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelPesinFiyatBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));

    tl_2 = new JLabel();
    GridBagConstraints gbc_tl_2 = new GridBagConstraints();
    gbc_tl_2.anchor = GridBagConstraints.WEST;
    gbc_tl_2.insets = new Insets(0, 0, 5, 0);
    gbc_tl_2.gridx = 2;
    gbc_tl_2.gridy = 2;
    jPanelStokVeriler.add(tl_2, gbc_tl_2);
    tl_2.setVerticalAlignment(SwingConstants.BOTTOM);
    tl_2.setText("TL");
    tl_2.setFont(new Font("Tahoma", Font.BOLD, 11));

    jLabelTaksitliFiyat = new JLabel();
    GridBagConstraints gbc_jLabelTaksitliFiyat = new GridBagConstraints();
    gbc_jLabelTaksitliFiyat.anchor = GridBagConstraints.WEST;
    gbc_jLabelTaksitliFiyat.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelTaksitliFiyat.gridx = 0;
    gbc_jLabelTaksitliFiyat.gridy = 3;
    jPanelStokVeriler.add(jLabelTaksitliFiyat, gbc_jLabelTaksitliFiyat);
    jLabelTaksitliFiyat.setText("Toplam taksitli fiyat");
    jLabelTaksitliFiyat.setFont(new Font("Tahoma", Font.BOLD, 14));

    jLabelTaksitliFiyatBilgi = new JLabel();
    GridBagConstraints gbc_jLabelTaksitliFiyatBilgi = new GridBagConstraints();
    gbc_jLabelTaksitliFiyatBilgi.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelTaksitliFiyatBilgi.gridx = 1;
    gbc_jLabelTaksitliFiyatBilgi.gridy = 3;
    jPanelStokVeriler.add(jLabelTaksitliFiyatBilgi,
        gbc_jLabelTaksitliFiyatBilgi);
    jLabelTaksitliFiyatBilgi.setText("0.00");
    jLabelTaksitliFiyatBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelTaksitliFiyatBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));

    tl_3 = new JLabel();
    GridBagConstraints gbc_tl_3 = new GridBagConstraints();
    gbc_tl_3.anchor = GridBagConstraints.WEST;
    gbc_tl_3.insets = new Insets(0, 0, 5, 0);
    gbc_tl_3.gridx = 2;
    gbc_tl_3.gridy = 3;
    jPanelStokVeriler.add(tl_3, gbc_tl_3);
    tl_3.setVerticalAlignment(SwingConstants.BOTTOM);
    tl_3.setText("TL");
    tl_3.setFont(new Font("Tahoma", Font.BOLD, 11));

    jLabelStokTabloGrup = new JLabel();
    GridBagConstraints gbc_jLabelStokTabloGrup = new GridBagConstraints();
    gbc_jLabelStokTabloGrup.anchor = GridBagConstraints.WEST;
    gbc_jLabelStokTabloGrup.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelStokTabloGrup.gridx = 0;
    gbc_jLabelStokTabloGrup.gridy = 4;
    jPanelStokVeriler.add(jLabelStokTabloGrup, gbc_jLabelStokTabloGrup);
    jLabelStokTabloGrup.setText("Tablo grup sayısı");
    jLabelStokTabloGrup.setFont(new Font("Tahoma", Font.BOLD, 14));

    jLabelUrunStokAdet = new JLabel();
    GridBagConstraints gbc_jLabelUrunStokAdet = new GridBagConstraints();
    gbc_jLabelUrunStokAdet.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelUrunStokAdet.gridx = 1;
    gbc_jLabelUrunStokAdet.gridy = 4;
    jPanelStokVeriler.add(jLabelUrunStokAdet, gbc_jLabelUrunStokAdet);
    jLabelUrunStokAdet.setText("0");
    jLabelUrunStokAdet.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelUrunStokAdet.setFont(new Font("Tahoma", Font.BOLD, 14));

    adet_1 = new JLabel();
    GridBagConstraints gbc_adet_1 = new GridBagConstraints();
    gbc_adet_1.anchor = GridBagConstraints.WEST;
    gbc_adet_1.insets = new Insets(0, 0, 5, 0);
    gbc_adet_1.gridx = 2;
    gbc_adet_1.gridy = 4;
    jPanelStokVeriler.add(adet_1, gbc_adet_1);
    adet_1.setVerticalAlignment(SwingConstants.BOTTOM);
    adet_1.setText("ADET");
    adet_1.setFont(new Font("Tahoma", Font.BOLD, 11));

    jLabelStokTabloAdet = new JLabel();
    GridBagConstraints gbc_jLabelStokTabloAdet = new GridBagConstraints();
    gbc_jLabelStokTabloAdet.anchor = GridBagConstraints.WEST;
    gbc_jLabelStokTabloAdet.insets = new Insets(0, 0, 0, 5);
    gbc_jLabelStokTabloAdet.gridx = 0;
    gbc_jLabelStokTabloAdet.gridy = 5;
    jPanelStokVeriler.add(jLabelStokTabloAdet, gbc_jLabelStokTabloAdet);
    jLabelStokTabloAdet.setText("Tablodaki ürün adeti");
    jLabelStokTabloAdet.setFont(new Font("Tahoma", Font.BOLD, 14));

    jLabelStokTabloAdetBilgi = new JLabel();
    GridBagConstraints gbc_jLabelStokTabloAdetBilgi = new GridBagConstraints();
    gbc_jLabelStokTabloAdetBilgi.insets = new Insets(0, 0, 0, 5);
    gbc_jLabelStokTabloAdetBilgi.gridx = 1;
    gbc_jLabelStokTabloAdetBilgi.gridy = 5;
    jPanelStokVeriler.add(jLabelStokTabloAdetBilgi,
        gbc_jLabelStokTabloAdetBilgi);
    jLabelStokTabloAdetBilgi.setText("0");
    jLabelStokTabloAdetBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelStokTabloAdetBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));

    adet_2 = new JLabel();
    GridBagConstraints gbc_adet_2 = new GridBagConstraints();
    gbc_adet_2.anchor = GridBagConstraints.WEST;
    gbc_adet_2.gridx = 2;
    gbc_adet_2.gridy = 5;
    jPanelStokVeriler.add(adet_2, gbc_adet_2);
    adet_2.setVerticalAlignment(SwingConstants.BOTTOM);
    adet_2.setText("ADET");
    adet_2.setFont(new Font("Tahoma", Font.BOLD, 11));

    jPanelSatisVeriler = new JPanel();
    jPanelSatisVeriler.setBorder(new LineBorder(new Color(0, 0, 0)));
    GridBagConstraints gbc_jPanelSatisVeriler = new GridBagConstraints();
    gbc_jPanelSatisVeriler.fill = GridBagConstraints.BOTH;
    gbc_jPanelSatisVeriler.gridheight = 2;
    gbc_jPanelSatisVeriler.gridx = 2;
    gbc_jPanelSatisVeriler.gridy = 4;
    jPanelAnaliz.add(jPanelSatisVeriler, gbc_jPanelSatisVeriler);
    GridBagLayout gbl_jPanelSatisVeriler = new GridBagLayout();
    gbl_jPanelSatisVeriler.columnWidths = new int[] { 204, 31, 61, 0 };
    gbl_jPanelSatisVeriler.rowHeights = new int[] { 26, 17, 17, 17, 28, 0 };
    gbl_jPanelSatisVeriler.columnWeights = new double[] { 1.0, 0.0, 1.0,
        Double.MIN_VALUE };
    gbl_jPanelSatisVeriler.rowWeights = new double[] { 0.0, 1.0, 1.0, 1.0,
        1.0, Double.MIN_VALUE };
    jPanelSatisVeriler.setLayout(gbl_jPanelSatisVeriler);

    jLabelSatisVeriler = new JLabel("SATIŞ TABLOSU VERİLERİ");
    jLabelSatisVeriler.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelSatisVeriler = new GridBagConstraints();
    gbc_jLabelSatisVeriler.anchor = GridBagConstraints.WEST;
    gbc_jLabelSatisVeriler.fill = GridBagConstraints.VERTICAL;
    gbc_jLabelSatisVeriler.insets = new Insets(0, 0, 5, 0);
    gbc_jLabelSatisVeriler.gridwidth = 3;
    gbc_jLabelSatisVeriler.gridx = 0;
    gbc_jLabelSatisVeriler.gridy = 0;
    jPanelSatisVeriler.add(jLabelSatisVeriler, gbc_jLabelSatisVeriler);
    jLabelSatisVeriler.setHorizontalAlignment(SwingConstants.CENTER);

    jLabelPesinSatis = new JLabel();
    jLabelPesinSatis.setText("Toplam Peşin Satış Tutarı");
    jLabelPesinSatis.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelPesinSatis = new GridBagConstraints();
    gbc_jLabelPesinSatis.anchor = GridBagConstraints.WEST;
    gbc_jLabelPesinSatis.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelPesinSatis.gridx = 0;
    gbc_jLabelPesinSatis.gridy = 1;
    jPanelSatisVeriler.add(jLabelPesinSatis, gbc_jLabelPesinSatis);

    jLabelPesinSatisBilgi = new JLabel();
    jLabelPesinSatisBilgi.setText("0.00");
    jLabelPesinSatisBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelPesinSatisBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelPesinSatisBilgi = new GridBagConstraints();
    gbc_jLabelPesinSatisBilgi.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelPesinSatisBilgi.gridx = 1;
    gbc_jLabelPesinSatisBilgi.gridy = 1;
    jPanelSatisVeriler
        .add(jLabelPesinSatisBilgi, gbc_jLabelPesinSatisBilgi);

    tl_4 = new JLabel();
    tl_4.setVerticalAlignment(SwingConstants.BOTTOM);
    tl_4.setText("TL");
    tl_4.setFont(new Font("Tahoma", Font.BOLD, 11));
    GridBagConstraints gbc_tl_4 = new GridBagConstraints();
    gbc_tl_4.anchor = GridBagConstraints.WEST;
    gbc_tl_4.insets = new Insets(0, 0, 5, 0);
    gbc_tl_4.gridx = 2;
    gbc_tl_4.gridy = 1;
    jPanelSatisVeriler.add(tl_4, gbc_tl_4);

    jLabelTaksitliSatis = new JLabel();
    jLabelTaksitliSatis.setText("Toplam Taksitli Satış Tutarı");
    jLabelTaksitliSatis.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelTaksitliSatis = new GridBagConstraints();
    gbc_jLabelTaksitliSatis.anchor = GridBagConstraints.WEST;
    gbc_jLabelTaksitliSatis.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelTaksitliSatis.gridx = 0;
    gbc_jLabelTaksitliSatis.gridy = 2;
    jPanelSatisVeriler.add(jLabelTaksitliSatis, gbc_jLabelTaksitliSatis);

    jLabelTaksitliSatisBilgi = new JLabel();
    jLabelTaksitliSatisBilgi.setText("0.00");
    jLabelTaksitliSatisBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelTaksitliSatisBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelTaksitliSatisBilgi = new GridBagConstraints();
    gbc_jLabelTaksitliSatisBilgi.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelTaksitliSatisBilgi.gridx = 1;
    gbc_jLabelTaksitliSatisBilgi.gridy = 2;
    jPanelSatisVeriler.add(jLabelTaksitliSatisBilgi,
        gbc_jLabelTaksitliSatisBilgi);

    tl_5 = new JLabel();
    tl_5.setVerticalAlignment(SwingConstants.BOTTOM);
    tl_5.setText("TL");
    tl_5.setFont(new Font("Tahoma", Font.BOLD, 11));
    GridBagConstraints gbc_tl_5 = new GridBagConstraints();
    gbc_tl_5.anchor = GridBagConstraints.WEST;
    gbc_tl_5.insets = new Insets(0, 0, 5, 0);
    gbc_tl_5.gridx = 2;
    gbc_tl_5.gridy = 2;
    jPanelSatisVeriler.add(tl_5, gbc_tl_5);

    jLabelSatisTabloGrup = new JLabel();
    jLabelSatisTabloGrup.setText("Tablo grup sayısı");
    jLabelSatisTabloGrup.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelSatisTabloGrup = new GridBagConstraints();
    gbc_jLabelSatisTabloGrup.anchor = GridBagConstraints.WEST;
    gbc_jLabelSatisTabloGrup.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelSatisTabloGrup.gridx = 0;
    gbc_jLabelSatisTabloGrup.gridy = 3;
    jPanelSatisVeriler.add(jLabelSatisTabloGrup, gbc_jLabelSatisTabloGrup);

    jLabelSatisTabloGrupBilgi = new JLabel();
    jLabelSatisTabloGrupBilgi.setText("0");
    jLabelSatisTabloGrupBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelSatisTabloGrupBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelSatisTabloGrupBilgi = new GridBagConstraints();
    gbc_jLabelSatisTabloGrupBilgi.insets = new Insets(0, 0, 5, 5);
    gbc_jLabelSatisTabloGrupBilgi.gridx = 1;
    gbc_jLabelSatisTabloGrupBilgi.gridy = 3;
    jPanelSatisVeriler.add(jLabelSatisTabloGrupBilgi,
        gbc_jLabelSatisTabloGrupBilgi);

    adet_3 = new JLabel();
    adet_3.setVerticalAlignment(SwingConstants.BOTTOM);
    adet_3.setText("ADET");
    adet_3.setFont(new Font("Tahoma", Font.BOLD, 11));
    GridBagConstraints gbc_adet_3 = new GridBagConstraints();
    gbc_adet_3.anchor = GridBagConstraints.WEST;
    gbc_adet_3.insets = new Insets(0, 0, 5, 0);
    gbc_adet_3.gridx = 2;
    gbc_adet_3.gridy = 3;
    jPanelSatisVeriler.add(adet_3, gbc_adet_3);

    jLabelSatisTabloAdet = new JLabel();
    jLabelSatisTabloAdet.setText("Tablodaki ürün adeti");
    jLabelSatisTabloAdet.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelSatisTabloAdet = new GridBagConstraints();
    gbc_jLabelSatisTabloAdet.anchor = GridBagConstraints.WEST;
    gbc_jLabelSatisTabloAdet.insets = new Insets(0, 0, 0, 5);
    gbc_jLabelSatisTabloAdet.gridx = 0;
    gbc_jLabelSatisTabloAdet.gridy = 4;
    jPanelSatisVeriler.add(jLabelSatisTabloAdet, gbc_jLabelSatisTabloAdet);

    jLabelSatisTabloAdetBilgi = new JLabel();
    jLabelSatisTabloAdetBilgi.setText("0");
    jLabelSatisTabloAdetBilgi.setHorizontalAlignment(SwingConstants.RIGHT);
    jLabelSatisTabloAdetBilgi.setFont(new Font("Tahoma", Font.BOLD, 14));
    GridBagConstraints gbc_jLabelSatisTabloAdetBilgi = new GridBagConstraints();
    gbc_jLabelSatisTabloAdetBilgi.insets = new Insets(0, 0, 0, 5);
    gbc_jLabelSatisTabloAdetBilgi.gridx = 1;
    gbc_jLabelSatisTabloAdetBilgi.gridy = 4;
    jPanelSatisVeriler.add(jLabelSatisTabloAdetBilgi,
        gbc_jLabelSatisTabloAdetBilgi);

    adet_4 = new JLabel();
    adet_4.setVerticalAlignment(SwingConstants.BOTTOM);
    adet_4.setText("ADET");
    adet_4.setFont(new Font("Tahoma", Font.BOLD, 11));
    GridBagConstraints gbc_adet_4 = new GridBagConstraints();
    gbc_adet_4.anchor = GridBagConstraints.WEST;
    gbc_adet_4.gridx = 2;
    gbc_adet_4.gridy = 4;
    jPanelSatisVeriler.add(adet_4, gbc_adet_4);

    initListener();
    fillCombobox();

    return jPanelAnaliz;
  }

  private void fillCombobox() {
    List<?> list;

    list = HibernateManager.getInstance().get(UrunBeden.class, false);
    UrunBeden ub = new UrunBeden();
    ub.setBeden(DEFAULT_COMBOBOX_VALUE);
    jComboBoxBeden.setInitialObject(ub);
    jComboBoxBeden.setObjects(list);

    list = HibernateManager.getInstance().get(UrunModel.class, false);
    UrunModel um = new UrunModel();
    um.setModel(DEFAULT_COMBOBOX_VALUE);
    jComboBoxModel.setInitialObject(um);
    jComboBoxModel.setObjects(list);

    list = HibernateManager.getInstance().get(UrunGrup.class, false);
    UrunGrup ug = new UrunGrup();
    ug.setGrup(DEFAULT_COMBOBOX_VALUE);
    jComboBoxGrup.setInitialObject(ug);
    jComboBoxGrup.setObjects(list);

    list = HibernateManager.getInstance().get(UrunMarka.class, false);
    UrunMarka urunM = new UrunMarka();
    urunM.setMarka(DEFAULT_COMBOBOX_VALUE);
    jComboBoxMarka.setInitialObject(urunM);
    jComboBoxMarka.setObjects(list);

    list = HibernateManager.getInstance().get(UrunCinsiyet.class, false);
    UrunCinsiyet uc = new UrunCinsiyet();
    uc.setCinsiyet(DEFAULT_COMBOBOX_VALUE);
    jComboBoxCinsiyet.setInitialObject(uc);
    jComboBoxCinsiyet.setObjects(list);

    list = HibernateManager.getInstance().get(Firma.class, false);
    Firma uf = new Firma();
    uf.setFirmaAd(DEFAULT_COMBOBOX_VALUE);
    jComboBoxFirma.setInitialObject(uf);
    jComboBoxFirma.setObjects(list);

    list = HibernateManager.getInstance().get(UrunSezon.class, false);
    UrunSezon us = new UrunSezon();
    us.setSezon(DEFAULT_COMBOBOX_VALUE);
    jComboBoxSezon.setInitialObject(us);
    jComboBoxSezon.setObjects(list);
  }

  private void initListener() {

    jTextFieldRenk.addMouseListener(new MouseListener() {

      @Override
      public void mouseReleased(MouseEvent arg0) {
        // TODO Auto-generated method stub

      }

      @Override
      public void mousePressed(MouseEvent arg0) {
        // TODO Auto-generated method stub

      }

      @Override
      public void mouseExited(MouseEvent arg0) {
        // TODO Auto-generated method stub

      }

      @Override
      public void mouseEntered(MouseEvent arg0) {
        // TODO Auto-generated method stub

      }

      @Override
      public void mouseClicked(MouseEvent arg0) {
        PSARenkSecimEkrani renkSecim = new PSARenkSecimEkrani(null);
        secilenRenk = renkSecim.showDialog();
        if (secilenRenk != null) {
          jTextFieldRenk.setBackground(secilenRenk.getColor());
          jTextFieldRenk.setText(secilenRenk.getName());
        } else {
          jTextFieldRenk.setBackground(Color.WHITE);
          jTextFieldRenk.setText("RENK YOK");
        }
      }
    });

    jButtonAra.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {
        araButtonClicked();
      }
    });

  }

  @SuppressWarnings("unchecked")
  protected void araButtonClicked() {
    if (PSAIstatistikEkrani.getSube().getSelectedItem().toString()
        .equals(COMBOBOX_VALUE)) {
      AutoClosingMessageDialog.showAutoClosingMessageDialog(
          "Aramak istediğiniz şubeyi seçiniz.", 2);
      return;
    }

    List<UrunSatisKasa> convertToUrunSatisKasa;
    String subeName = PSAIstatistikEkrani.getSube().getSelectedItem()
        .toString();

    if (detayliAramaFieldKonrol()) {
      if (subeName.equals(ALL_COMBOBOX_VALUE)) {
        urunStokListesi = (List<UrunStok>) HibernateManager
            .getInstance().get(UrunStok.class, false);
      } else {
        urunStokListesi = (List<UrunStok>) urunListesiHqlQuery(0,
            jDateChooserIlkTarih.getDate(),
            jDateChooserSonTarih.getDate());
      }
      urunSatisListesi = (List<UrunSatis>) urunListesiHqlQuery(1,
          jDateChooserIlkTarih.getDate(),
          jDateChooserSonTarih.getDate());
    } else {
      urunStokListesi = (List<UrunStok>) urunListesiHqlQuery(0,
          jDateChooserIlkTarih.getDate(),
          jDateChooserSonTarih.getDate());
      urunSatisListesi = (List<UrunSatis>) urunListesiHqlQuery(1,
          jDateChooserIlkTarih.getDate(),
          jDateChooserSonTarih.getDate());
    }

    if (urunStokListesi.size() == 0 && urunSatisListesi.size() == 0) {
      LinkedList<?> list = new LinkedList<>();
      cTableStok.setObjects(list);
      cTableSatis.setObjects(list);
      AutoClosingMessageDialog.showAutoClosingMessageDialog(
          "Arama sonucu ürün bulunmamaktadır.", 2);
    } else {
      urunStokDetayListesi = convertToUrunUrunStokDetay(urunStokListesi);
      cTableStok.setObjects(urunStokDetayListesi);
      convertToUrunSatisKasa = convertToUrunSatisKasa(urunSatisListesi);
      cTableSatis.setObjects(convertToUrunSatisKasa);
    }

    fillTableInfo();
  }

  private boolean detayliAramaFieldKonrol() {
    String barkod = jTextFieldBarkod.getText().trim();
    if (jComboBoxSezon.getSelectedIndex() == 0
        && jComboBoxGrup.getSelectedIndex() == 0
        && jComboBoxModel.getSelectedIndex() == 0
        && jComboBoxBeden.getSelectedIndex() == 0
        && jComboBoxCinsiyet.getSelectedIndex() == 0
        && jComboBoxMarka.getSelectedIndex() == 0
        && jComboBoxFirma.getSelectedIndex() == 0 && barkod.equals("")
        && secilenRenk == null)
      return true;
    return false;
  }

  private void fillTableInfo() {
    int urunStokSize = urunStokListesi.size();
    double urunStokAlisFiyati = 0;
    double urunStokPesinFiyati = 0;
    double urunStokTaksitliFiyati = 0;
    int urunStokAdet = 0;

    for (int i = 0; i < urunStokSize; i++) {
      UrunStok us = urunStokListesi.get(i);
      urunStokAlisFiyati = urunStokAlisFiyati
          + (us.getAlisFiyati() * us.getAdet());
      urunStokPesinFiyati = urunStokPesinFiyati
          + (us.getPesinSatisFiyati() * us.getAdet());
      urunStokTaksitliFiyati = urunStokTaksitliFiyati
          + (us.getTaksitliSatisFiyati() * us.getAdet());
      urunStokAdet = urunStokAdet + us.getAdet();
    }

    BigDecimal urunStokAlisFiyatBG = new BigDecimal(urunStokAlisFiyati);

    String dividedPrice = Utils.DECIMAL_FORMAT.format(urunStokAlisFiyatBG);
    jLabelAlisFiyatBilgi.setText(dividedPrice);

    BigDecimal urunStokPesinFiyatiBG = new BigDecimal(urunStokPesinFiyati);
    String dividedPricePesin = Utils.DECIMAL_FORMAT
        .format(urunStokPesinFiyatiBG);
    jLabelPesinFiyatBilgi.setText(dividedPricePesin);

    BigDecimal urunStokTaksitliFiyatiBG = new BigDecimal(
        urunStokTaksitliFiyati);
    String dividedPriceTaksitli = Utils.DECIMAL_FORMAT
        .format(urunStokTaksitliFiyatiBG);

    jLabelTaksitliFiyatBilgi.setText(dividedPriceTaksitli);

    jLabelUrunStokAdet.setText(String.valueOf(urunStokSize));
    jLabelStokTabloAdetBilgi.setText(String.valueOf(urunStokAdet));

    int urunSatisSize = urunSatisListesi.size();
    double urunSatisPesinFiyati = 0;
    double urunSatisTaksitliFiyati = 0;
    int urunSatisAdet = 0;

    for (int i = 0; i < urunSatisSize; i++) {
      UrunSatis us = urunSatisListesi.get(i);
      urunSatisPesinFiyati = urunSatisPesinFiyati
          + (us.getPesinSatisFiyati() * us.getAdet());
      urunSatisTaksitliFiyati = urunSatisTaksitliFiyati
          + (us.getTaksitliSatisFiyati() * us.getAdet());
      urunSatisAdet = urunSatisAdet + us.getAdet();
    }

    BigDecimal urunSatisPesinFiyatiBG = new BigDecimal(urunSatisPesinFiyati);
    String dividedPriceSatisPesin = Utils.DECIMAL_FORMAT
        .format(urunSatisPesinFiyatiBG);
    jLabelPesinSatisBilgi.setText(dividedPriceSatisPesin);

    BigDecimal urunSatisTaksitliFiyatiBG = new BigDecimal(
        urunSatisTaksitliFiyati);
    String dividedPriceSatisTaksitli = Utils.DECIMAL_FORMAT
        .format(urunSatisTaksitliFiyatiBG);
    jLabelTaksitliSatisBilgi.setText(dividedPriceSatisTaksitli);

    jLabelSatisTabloGrupBilgi.setText(String.valueOf(urunSatisSize));
    jLabelSatisTabloAdetBilgi.setText(String.valueOf(urunSatisAdet));

  }

  private List<?> urunListesiHqlQuery(int tableState, Date from, Date to) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(from);
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    from = cal.getTime();

    cal.setTime(to);
    cal.set(Calendar.HOUR_OF_DAY, 23);
    cal.set(Calendar.MINUTE, 59);
    cal.set(Calendar.SECOND, 59);
    cal.set(Calendar.MILLISECOND, 99);
    to = cal.getTime();

    Session openSession = HibernateManager.getInstance().openSession();
    openSession.beginTransaction();

    String barkod = jTextFieldBarkod.getText().trim();
    StringBuilder sBuilder = new StringBuilder();

    if (tableState == 0) {
      sBuilder.append("from UrunStok where ");
    } else {
      sBuilder.append("from UrunSatis where ");
    }

    String subeName = PSAIstatistikEkrani.getSube().getSelectedItem()
        .toString();

    if (!subeName.equals(ALL_COMBOBOX_VALUE)) {
      sBuilder.append("systemName = '").append(subeName + "'");
    }

    if (tableState == 1) {
      if (!subeName.equals(ALL_COMBOBOX_VALUE)) {
        sBuilder.append(" and ");
      }
      sBuilder.append("tarih >= ").append(":from");
      sBuilder.append(" and tarih <=").append(":to");
      andGirildimi = 1;
    }

    if (!barkod.equals("")) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "barkod", barkod);
    }

    if (jComboBoxSezon.getSelectedItem() != null
        && jComboBoxSezon.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "sezon",
          jComboBoxSezon.getSelectedItem().toString());
    }

    if (jComboBoxGrup.getSelectedItem() != null
        && jComboBoxGrup.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "grup",
          jComboBoxGrup.getSelectedItem().toString());
    }

    if (jComboBoxModel.getSelectedItem() != null
        && jComboBoxModel.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "model",
          jComboBoxModel.getSelectedItem().toString());
    }

    if (jComboBoxBeden.getSelectedItem() != null
        && jComboBoxBeden.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "beden",
          jComboBoxBeden.getSelectedItem().toString());
    }

    if (jComboBoxCinsiyet.getSelectedItem() != null
        && jComboBoxCinsiyet.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "cinsiyet",
          jComboBoxCinsiyet.getSelectedItem().toString());
    }

    if (jComboBoxMarka.getSelectedItem() != null
        && jComboBoxMarka.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "marka",
          jComboBoxMarka.getSelectedItem().toString());
    }

    if (jComboBoxFirma.getSelectedItem() != null
        && jComboBoxFirma.getSelectedIndex() != 0) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "firmaAd",
          jComboBoxFirma.getSelectedItem().toString());
    }

    if (secilenRenk != null) {
      sBuilder = hqlStringiOlustur(subeName, sBuilder, "renkAd",
          jTextFieldRenk.getText());
    }

    String hql = sBuilder.toString();
    Query createQuery = openSession.createQuery(hql);
    if (tableState == 1) {
      createQuery.setParameter("from", from);
      createQuery.setParameter("to", to);
    }

    List<?> list = createQuery.list();
    openSession.close();
    andGirildimi = 0;

    return list;
  }

  public StringBuilder hqlStringiOlustur(String subeName,
      StringBuilder sBuilder, String fieldName, String fieldValue) {

    if (subeName.equals(ALL_COMBOBOX_VALUE)) {
      if (andGirildimi == 0) {
        sBuilder.append(fieldName + " = '" + fieldValue + "'");
        andGirildimi = 1;
      } else {
        sBuilder.append(" and " + fieldName + " = '" + fieldValue + "'");
      }
    }

    if (!subeName.equals(ALL_COMBOBOX_VALUE)) {
      sBuilder.append(" and " + fieldName + " = '" + fieldValue + "'");
    }

    return sBuilder;
  }

  private static List<UrunSatisKasa> convertToUrunSatisKasa(
      List<UrunSatis> list) {
    List<UrunSatisKasa> kasaList = new LinkedList<>();
    for (UrunSatis urunSatis : list) {
      UrunSatisKasa kasaUrun = new UrunSatisKasa(urunSatis);
      kasaUrun.setSatisDurum(urunSatis.getSatisDurum());
      kasaUrun.setSatisId(urunSatis.getSatisId());
      kasaUrun.setYapilanSatis(urunSatis.isYapilanSatis());
      kasaList.add(kasaUrun);
    }
    return kasaList;
  }

  private static List<UrunStokDetayliArama> convertToUrunUrunStokDetay(
      List<UrunStok> list) {
    List<UrunStokDetayliArama> urunDetayList = new LinkedList<>();
    for (UrunStok urunStok : list) {
      UrunStokDetayliArama urunStokDetay = new UrunStokDetayliArama(
          urunStok);
      urunDetayList.add(urunStokDetay);
    }
    return urunDetayList;
  }
}
TOP

Related Classes of gui.PSAAnalizPanel

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.