Esempio n. 1
0
        public ViewOrderedItemForm(ref Session session)
        {
            InitializeComponent();

            this.Text = "เดชาพาณิชย์ - รายการสินค้าเฉพาะ";
            this.session = session;

            cbMinWidth = comboBox1.Width;
            dgvMinHeight = dataGridView1.Height;
            dgvMinWidth = dataGridView1.Width;
            btnYLoc = btnCopy.Location.Y;

            dataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            dataGridView1.RowTemplate.Height = 30;
            dataGridView1.RowHeadersVisible = false;

            // INITIALIZE ITEM
            List<string> uniqueNameList = session.GetEveryOrderedItemName();

            foreach (string name in uniqueNameList)
                comboBox1.Items.Add(name);

            if(comboBox1.Items.Count > 0)
                comboBox1.SelectedIndex = 0;
        }
Esempio n. 2
0
 public SerialObject(Space.RouteType route, 
     List<CustomerInfo> customersList,
     List<Product> productsList,
     List<Product> productsListAmr,
     Session session,
     int defaultTab,
     string date)
 {
     this.route = route;
     this.customersList = customersList;
     this.productsList = productsList;
     this.productsListAmr = productsListAmr;
     this.session = session;
     this.defaultTab = defaultTab;
     this.date = date;
 }
Esempio n. 3
0
        public AllBillsForm(ref Session session, string routeName, string date)
        {
            InitializeComponent();

            this.session = session;
            this.routeName = routeName;
            this.date = date;

            rtfMinWidth = rtf1.Width;
            rtfMinHright = rtf1.Height;
            btnMinY = buttonRecalculate.Location.Y;

            this.Text = "เดชาพาณิชย์ - บิลทั้งหมด";

            // Tempolary variable initialization
            dcpCustName = new List<string>();
            dcpCustAmount = new List<double>();
            amrCustName = new List<string>();
            amrCustAmount = new List<double>();

            DisplayAllBills();
            InitializePrinter();
        }
Esempio n. 4
0
        public OrderMakerForm(Space.RouteType route, Space.SessionCommand command, string note)
        {
            InitializeComponent();

            this.Text = "เดชาพาณิชย์";

            ImageList imageList = new ImageList();
            imageList.Images.Add(Bitmap.FromFile("shopping-cart-empty-icon.png"));
            imageList.Images.Add(Bitmap.FromFile("shopping-cart-icon.png"));
            imageList.Images.Add(Bitmap.FromFile("shopping-cart-skip-icon.png"));

            lvCustomerList.StateImageList = imageList;

            // lvCustomerList.FullRowSelect = true;
            // lvCustomerList.GridLines = true;
            lvCustomerList.Sorting = SortOrder.Ascending;
            lvCustomerList.MultiSelect = false;

            lvCustomerList.Items[0].StateImageIndex = 0;
            lvCustomerList.Items[1].StateImageIndex = 1;

            orderMakerFormMinHeight = this.Size.Height;
            orderMakerFormMinWidth = this.Size.Width;
            gbCustomerListMinHeight = gbCustomerList.Height;
            tbContainerMinHeight = tbContainer.Size.Height;
            tbContainerMinWidth = tbContainer.Size.Width;

            tpMinHeight = tpDcp.Size.Height;
            tpMinWidth = tpDcp.Size.Width;

            lbSuggestItemsMinHeight = this.lbMatchedItems.Height;
            lbSuggestItemsMinWidth = this.lbMatchedItems.Width;

            btnClearXLocation = btnClear.Location.X;

            tsDefaultMerchant.Items.Add("เรา");
            tsDefaultMerchant.Items.Add("อาม่า");
            tsDefaultMerchant.SelectedIndex = 0;
            defaultTab = 0;

            this.route = route;

            lbMatchedItems.SelectionMode = SelectionMode.One;

            ///// DCP
            dgvDcp.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvDcp.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvDcp.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvDcp.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            DataGridViewColumn dgvcPrice = new DataGridViewTextBoxColumn();
            dgvcPrice.Visible = false;
            dgvcPrice.Name = "Price";
            dgvcPrice.HeaderText = "Price";

            DataGridViewColumn dgvcMultiplier = new DataGridViewTextBoxColumn();
            dgvcMultiplier.Visible = false;
            dgvcMultiplier.Name = "Multiplier";
            dgvcMultiplier.HeaderText = "Multiplier";

            dgvDcp.Columns.Add(dgvcPrice);
            dgvDcp.Columns.Add(dgvcMultiplier);

            dgvDcp.RowTemplate.MinimumHeight = 30;

            ///// AMR
            dgvAmr.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvAmr.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvAmr.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            dgvAmr.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            DataGridViewColumn dgvcPricedgvAmr = new DataGridViewTextBoxColumn();
            dgvcPricedgvAmr.Visible = false;
            dgvcPricedgvAmr.Name = "Price";
            dgvcPricedgvAmr.HeaderText = "Price";

            DataGridViewColumn dgvcMultiplierdgvAmr = new DataGridViewTextBoxColumn();
            dgvcMultiplierdgvAmr.Visible = false;
            dgvcMultiplierdgvAmr.Name = "Multiplier";
            dgvcMultiplierdgvAmr.HeaderText = "Multiplier";

            dgvAmr.Columns.Add(dgvcPricedgvAmr);
            dgvAmr.Columns.Add(dgvcMultiplierdgvAmr);

            dgvAmr.RowTemplate.MinimumHeight = 30;

            if (command == Space.SessionCommand.EditSession)
            {
                // Load data from session
                IFormatter formatter = new BinaryFormatter();
                Stream stream = new FileStream(note, FileMode.Open, FileAccess.Read, FileShare.Read);
                SerialObject serialObj = (SerialObject)formatter.Deserialize(stream);
                stream.Close();

                this.customersList = serialObj.CustomerList;
                this.productsList = serialObj.ProductList;
                this.productsListAmr = serialObj.ProductListAmr;
                this.session = serialObj.Session;
                this.defaultTab = serialObj.DefaultTab;
                this.route = serialObj.Route;

                ///// Set Topline information
                string[] routeName = Space.GetRouteOption();
                this.labelRouteName.Text = "สาย " + routeName[(int)this.route - 1];
                this.labelSessionDate.Text = serialObj.Date;

                ///// Restored Customer List
                lvCustomerList.Items.Clear();

                for (int i = 0; i < customersList.Count; i++)
                {
                    lvCustomerList.Items.Add(customersList[i].CustomerName, customersList[i].CustomerName, 0);
                    lvCustomerList.Items[i].StateImageIndex = 0;
                }
                gbCustomerList.Text = "รายชื่อ ลูกค้า " + string.Format("({0}/{1})", session.GetNumberOfCustomerWhoHaveOrdered(), customersList.Count);

                lvCustomerList.Items[0].Selected = true;

                UpdateEveryCustomerIcon();
            }
            else
            {
                setTopLineInfo();
                InitializeCustomerList();
                InitializeProductList();
                // Create a new seesion
                session = new Session(labelSessionDate.Text, route);
            }
        }