Exemple #1
0
 private void button28_Click(object sender, EventArgs e)
 {
     BillShipList cBSList = new BillShipList(cID);
     if (FormMode == "EDIT")
     {
         cBSList.DeleteCustBillShip(ShipID);
     }
     //Delete
     this.Hide();
 }
Exemple #2
0
 private void button27_Click(object sender, EventArgs e)
 {
     //Save or Update
     BillShipList cBSList = new BillShipList(cID);
     if (FormMode == "NEW")
     {
         cBSList.AddCustBillShip(Form2Object());
     }
     else if (FormMode == "EDIT")
     {
         CustBillShip c = new CustBillShip();
         c = Form2Object();
         c.ID = ShipID;
         cBSList.UpdateCustBillShip(c);
     }
     this.Hide();
 }
Exemple #3
0
        private void UpdatePOShip(int QTS,int ONH)
        {
            string DataGrid_PO = "";
            string DataGrid_POStat;
            int DataGrid_Inv = 0;
            int DataGrid_OnHand = 0;
            int DataGrid_ShipQuan = 0;
            int totalavqty = 0;
            int POID = 0;
            Shippers shipr = new Shippers();
            CustBillShip bill = new CustBillShip();
            CustBillShip ship = new CustBillShip();

            /* item.Cells[0].Value = po.PoNumber;
            item.Cells[1].Value = po.ReceiveDate;
            item.Cells[2].Value = po.InitialQty;
            item.Cells[3].Value = po.FabRejectQty;
            item.Cells[4].Value = po.PaintRejectQty;
            item.Cells[5].Value = po.InventoryQty;
            item.Cells[6].Value = po.ShippedQty;
            item.Cells[7].Value = po.Status;
            item.Cells[8].Value = po.Id;
            */

            int j = 0;
            while (j < InvPOGrid.RowCount)
            {
                if (QTS  != 0)
                {
                    POID = int.Parse(InvPOGrid.Rows[j].Cells[8].Value.ToString());
                    DataGrid_POStat = InvPOGrid.Rows[j].Cells[7].Value.ToString();
                    DataGrid_PO = InvPOGrid.Rows[j].Cells[0].Value.ToString();
                    DataGrid_Inv = int.Parse(InvPOGrid.Rows[j].Cells[5].Value.ToString());
                    DataGrid_OnHand = int.Parse(InvPOGrid.Rows[j].Cells[9].Value.ToString());
                    DataGrid_ShipQuan = int.Parse(InvPOGrid.Rows[j].Cells[6].Value.ToString());
                    if (DataGrid_Inv <= QTS)
                    {
                        DataGrid_ShipQuan = DataGrid_ShipQuan + DataGrid_Inv;
                        QTS = QTS - DataGrid_Inv;
                        DataGrid_Inv = 0;
                        DataGrid_OnHand = DataGrid_OnHand - DataGrid_ShipQuan;
                        if (DataGrid_POStat != "OPEN_INV")
                        {
                            DataGrid_POStat = "SHIPPED";
                        }
                    }
                    else
                    {
                        DataGrid_ShipQuan = DataGrid_ShipQuan + QTS;
                        DataGrid_Inv = DataGrid_Inv - QTS;
                        DataGrid_OnHand = DataGrid_OnHand - QTS;
                        QTS = 0;
                    }

                    int CustID;
                    Customer TCust = CustList.SearchCustomer(CustCombo.Text);
                    CustID = TCust.ID;
                    BillShipList BSList;
                    BSList = new BillShipList(TCust.ID);

                    InvPOGrid.Rows[j].Cells[6].Value = DataGrid_ShipQuan.ToString();
                    InvPOGrid.Rows[j].Cells[5].Value = DataGrid_Inv.ToString();
                    string RcvDate = InvPOGrid.Rows[j].Cells[1].Value.ToString();
                    shipr = Shippers.SearchShipper(ShipViaCombo.Text);
                    bill = BSList.SearchBillShip(BillToCombo.Text, "Billing");
                    ship = BSList.SearchBillShip(BillToCombo.Text, "Shipping");
                    if (bill.AddressName == "")
                    {
                        bill.ID = 0;
                    }
                    if (ship.AddressName == "")
                    {
                        ship.ID = 0;
                    }
                    if (bill.ID == 0)
                    {
                        bill.ID = ship.ID;
                    }
                    if (ship.ID == 0)
                    {
                        ship.ID = bill.ID;
                    }

                    shipList.ShipPO(DataGrid_PO, CustID, PartCombo.Text, RcvDate, TrackingTB.Text, shipComment, DataGrid_ShipQuan,
                                    ship.ID, DataGrid_Inv, DataGrid_OnHand, DataGrid_POStat,bill.ID);
                    shipList.CreateShipmentRecord(CustID, PartCombo.Text, DataGrid_ShipQuan, POID, TrackingTB.Text,
                                                  ship.ID, bill.ID, shipr.ID);
                    //Update Database
                }
                j++;

                totalavqty = totalavqty + DataGrid_Inv;
            }
        }
Exemple #4
0
        private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
        {
            BillShipList BSList;
            Customer TCust = CustList.SearchCustomer(CustCombo.Text);
            BSList = new BillShipList(TCust.ID);
            BillToCombo.DataSource = BSList.ListBilling();

            AddrCombo.DataSource = BSList.ListShipping();

            custNamelbl.Text = TCust.CustName;
            PartList = new PartsList();

            PartCombo.DataSource = PartList.GetCustParts(TCust.ID);
            if (PartCombo.Items.Count == 0)
            {
                PartCombo.Text = "";
                ClearCount(sender, e);
                clearINVPOlist();
            }
               //Get ShipVia Box
        }
Exemple #5
0
 private void LoadBillShip(int cID)
 {
     BillShipList cBSList = new BillShipList(cID);
     clearlist();
     if (cID != 0)
     {
         cBSList = new BillShipList(cID);
         foreach(CustBillShip c in cBSList.GetCustBillShip())
         {
             DataGridViewRow item = new DataGridViewRow();
             item.CreateCells(dataGridView5);
             item.Cells[0].Value = c.AddressName;
             item.Cells[1].Value = c.AddressType;
             dataGridView5.Rows.Add(item);
         }
     }
 }
Exemple #6
0
        private void EditAddress()
        {
            try
            {
                DataGridViewRow item = dataGridView5.SelectedRows[0];
                String strAddrName = item.Cells[0].Value.ToString(); ;
                String strAddrType = item.Cells[1].Value.ToString();

                Customer c1 = CustList.SearchCustomer(CustIDcombo.Text);
                BillShipList cBSList = new BillShipList(c1.ID);
                if (cBSList.BillShipExists(strAddrName, strAddrType))
                {
                    CustBillShip c2 = cBSList.SearchBillShip(strAddrName, strAddrType);
                    BillShipAddrForm f2 = new BillShipAddrForm(ref c2, "EDIT");
                    f2.ShowDialog();
                    LoadBillShip(c1.ID);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Edit Address " + ex.Message);
            }
        }
Exemple #7
0
 private void DeleteAllBillShip(int cID)
 {
     try
     {
         BillShipList cBSList = new BillShipList(cID);
         ArrayList delList = new ArrayList();
         foreach (CustBillShip c in cBSList.GetCustBillShip())
         {
             delList.Add(c.ID);
         }
         foreach (int i in delList)
         {
             cBSList.DeleteCustBillShip(i);
         }
         clearlist();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #8
0
        //Delete A Shipping Address
        private void button70_Click(object sender, EventArgs e)
        {
            // Delete Address
            if (dataGridView5.SelectedCells.Count > 0)
            {

                DialogResult result = MessageBox.Show("Are you sure you want to delete the current Address? " +
                    "Doing so will also delete the  selected BillTo or ShipTo Address.",
                    "Delete Address?",
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2,
                    MessageBoxOptions.DefaultDesktopOnly,
                    false);

                if (result == DialogResult.Yes)
                {
                    try
                    {
                        string strAddrName;
                        string strAddrType;

                        strAddrName = dataGridView5.SelectedCells[0].Value.ToString();
                        strAddrType = dataGridView5.SelectedCells[1].Value.ToString();
                        Customer c1 = new Customer();
                        c1 = CustList.SearchCustomer(CustIDcombo.Text);
                        BillShipList cBSList = new BillShipList(c1.ID);
                        cBSList.DeleteCustBillShip(cBSList.SearchBillShip(strAddrName, strAddrType).ID);
                        LoadBillShip(c1.ID);
                    }

                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                }
            }
        }