Exemplo n.º 1
0
 public SoView(So so)
 {
     InitializeComponent();
     soList = new List<So>();
     soList.Add(so);
     this.Text = "Info for SO:" + so.soId;
 }
Exemplo n.º 2
0
        public static bool UpdateSoMain(So so)
        {
            string strSql = string.Format("update So set customerName='{0}',contact='{1}',salesId={2},salesOrderNo='{3}',customerPo='{4}',paymentTerm='{5}',freightTerm='{6}',customerAccount='{7}',specialInstructions='{8}',billTo='{9}',shipTo='{10}' where soId={11}",
                                          so.customerName, so.contact, so.salesId, so.salesOrderNo, so.customerPo, so.paymentTerm, so.freightTerm, so.customerAccount, so.specialInstructions, so.billTo, so.shipTo, so.soId);

            if (db.ExecDataBySql(strSql) == 1)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public static bool SaveSoMain(So so)
        {
            string strSql = "insert into So(rfqId,customerName,contact,salesId,salesOrderNo,orderDate,customerPo,paymentTerm,freightTerm,customerAccount,specialInstructions,billTo,shipTo,soStates) " +
                            string.Format(" values({0},'{1}','{2}',{3},'{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}',0)", so.rfqId, so.customerName, so.contact, so.salesId, so.salesOrderNo, so.orderDate.ToShortDateString(), so.customerPo,
                                          so.paymentTerm, so.freightTerm, so.customerAccount, so.specialInstructions, so.billTo, so.shipTo);

            if (db.ExecDataBySql(strSql) == 1)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        public void FillTheTable(So so)
        {
            this.soId = so.soId;
            tbCustomer.Text = so.customerName;
            tbContact.Text = so.contact;
            tbSalesOrder.Text = so.salesOrderNo;
            if (so.approverId != null)
            {
                tbApprover.Text = new AmbleClient.Admin.AccountMgr.AccountMgr().GetNameById(so.approverId.Value);
            }
            if (so.approveDate != null)
            {
                tbApproveDate.Text = so.approveDate.Value.ToShortDateString();
            }
             dateTimePicker1.Value = so.orderDate;
            tbCustomerPo.Text = so.customerPo;
            tbPaymentTerm.Text = so.paymentTerm;
            tbFreightTerm.Text = so.freightTerm;
            tbCustomerAccount.Text = so.customerAccount;
            tbSpecialInstructions.Text = so.specialInstructions;
            tbBillto.Text = so.billTo;
            tbShipTo.Text = so.shipTo;
            //Fill the sales ID
            FillTheSalesComboBox();

            cbSp.SelectedIndex = mySubs.IndexOf(so.salesId);

            foreach (SoItems item in SoMgr.GetSoItemsAccordingToSoId(so.soId))
            {
                this.soItemsStateList.Add(
                new SoItemsContentAndState
                {
                    soitem = item,
                    state = OrderItemsState.Normal
                }
                );
            }
            ShowDataInDataGridView();
        }
Exemplo n.º 5
0
        public static bool UpdateSoMain(So so)
        {
            string strSql = string.Format("update So set customerName='{0}',contact='{1}',salesId={2},customerPo='{3}',paymentTerm='{4}',freightTerm='{5}',customerAccount='{6}',specialInstructions='{7}',billTo='{8}',shipTo='{9}' where soId={10}",
            so.customerName, so.contact, so.salesId, so.customerPo,so.paymentTerm, so.freightTerm, so.customerAccount, so.specialInstructions, so.billTo, so.shipTo,so.soId);

               if (db.ExecDataBySql(strSql) == 1)
               return true;

               return false;
        }
Exemplo n.º 6
0
        public static bool SaveSoMain(So so)
        {
            string strSql = "insert into So(customerName,contact,salesId,salesOrderNo,orderDate,customerPo,paymentTerm,freightTerm,customerAccount,specialInstructions,billTo,shipTo,soStates) " +
               string.Format(" values('{0}','{1}',{2},'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}',0)",so.customerName, so.contact, so.salesId, so.salesOrderNo, so.orderDate.ToShortDateString(), so.customerPo,
               so.paymentTerm, so.freightTerm, so.customerAccount, so.specialInstructions, so.billTo, so.shipTo);

               if (db.ExecDataBySql(strSql) == 1)
               return true;

               return false;
        }
Exemplo n.º 7
0
        static void FillTheSoSheet(ISheet sheet,So so, List<SoItemsContentAndState> soitemList)
        {
            sheet.GetRow(0).CreateCell(2).SetCellValue(so.customerName);
               sheet.GetRow(0).CreateCell(6).SetCellValue(so.contact);
               sheet.GetRow(0).CreateCell(9).SetCellValue(AmbleClient.Admin.AccountMgr.AccountMgr.GetNameById(so.salesId));

               if (so.approverId != null)
               {
               sheet.GetRow(0).CreateCell(14).SetCellValue(AmbleClient.Admin.AccountMgr.AccountMgr.GetNameById(so.approverId.Value) + "," + so.approveDate.Value.ToShortDateString());
               }
               sheet.GetRow(1).CreateCell(2).SetCellValue(so.salesOrderNo);
               sheet.GetRow(1).CreateCell(6).SetCellValue(so.orderDate.ToShortDateString());

               sheet.GetRow(1).CreateCell(9).SetCellValue(so.customerPo);
               sheet.GetRow(1).CreateCell(14).SetCellValue(so.paymentTerm);

               sheet.GetRow(2).CreateCell(2).SetCellValue(so.freightTerm);
               sheet.GetRow(2).CreateCell(6).SetCellValue(so.customerAccount);
               sheet.GetRow(2).CreateCell(9).SetCellValue(so.specialInstructions);

               IRow row = sheet.CreateRow(4);
               row.CreateCell(0).SetCellValue(so.billTo);
               row.CreateCell(8).SetCellValue(so.shipTo);

               int itemRowIndex = 9;
               foreach (SoItemsContentAndState scs in soitemList)
               {
               IRow itemRow = sheet.CreateRow(itemRowIndex);
               itemRow.CreateCell(0).SetCellValue(soitemList.IndexOf(scs)+1);
               string strSaleType;
               switch (scs.soitem.saleType)
               {

                   case 0:

                       strSaleType = "OEM EXCESS";
                       break;
                   case 1:
                       strSaleType = "OWN STOCK";
                       break;
                   case 2:
                       strSaleType = "OTHERS";
                       break;
                   default:
                       strSaleType = "ERROR";
                       break;

               }

               itemRow.CreateCell(1).SetCellValue(strSaleType);
               itemRow.CreateCell(2).SetCellValue(scs.soitem.partNo);
               itemRow.CreateCell(3).SetCellValue(scs.soitem.mfg);
               itemRow.CreateCell(4).SetCellValue(scs.soitem.rohs == 1 ? "Y" : "N");
               itemRow.CreateCell(5).SetCellValue(scs.soitem.dc);
               itemRow.CreateCell(6).SetCellValue(scs.soitem.intPartNo);
               itemRow.CreateCell(7).SetCellValue(scs.soitem.shipFrom);
               itemRow.CreateCell(8).SetCellValue(scs.soitem.shipMethod);
               itemRow.CreateCell(9).SetCellValue(scs.soitem.trackingNo);
               itemRow.CreateCell(10).SetCellValue(scs.soitem.qty);
               if (scs.soitem.qtyshipped != null)
               {
                   itemRow.CreateCell(11).SetCellValue(scs.soitem.qtyshipped.Value);
               }
               itemRow.CreateCell(12).SetCellValue(Enum.GetName(typeof(AmbleClient.Currency), scs.soitem.currencyType));
               itemRow.CreateCell(13).SetCellValue(scs.soitem.unitPrice);
               itemRow.CreateCell(14).SetCellValue(scs.soitem.unitPrice * scs.soitem.qty);
               itemRow.CreateCell(15).SetCellValue(scs.soitem.dockDate.ToShortDateString());

               if (scs.soitem.shippedDate != null)
               {
                   itemRow.CreateCell(16).SetCellValue(scs.soitem.shippedDate.Value.ToShortDateString());
               }
               itemRowIndex++;

               IRow infoRow=sheet.CreateRow(itemRowIndex);
               infoRow.CreateCell(1).SetCellValue("Shipping Instructions >>" + scs.soitem.shippingInstruction);
               sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(itemRowIndex,itemRowIndex,1,16));

               itemRowIndex++;
               infoRow=sheet.CreateRow(itemRowIndex);
               infoRow.CreateCell(1).SetCellValue("Packing Instructions >>" + scs.soitem.packingInstruction);
               sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(itemRowIndex,itemRowIndex,1,16));
               itemRowIndex++;
               }
        }
Exemplo n.º 8
0
        public void FillTheTable(So so,int? selectedItem)
        {
            this.soId = so.soId;

            this.selectedSoItemId = selectedItem;
            this.isNewCreateSo = false;

            if (UserInfo.Job == JobDescription.Purchaser)
            {
                tbCustomer.Text = "";
            }
            else
            {
                tbCustomer.Text = so.customerName;
            }

            if (UserInfo.Job == JobDescription.Purchaser || UserInfo.Job == JobDescription.PurchasersManager)
            {
                tbContact.Text = "";

            }
            else
            {
                tbContact.Text = so.contact;
            }
                tbSalesOrder.Text = Tool.Get6DigitalNumberAccordingToId(so.soId);
            if (so.approverId != null)
            {
                tbApprover.Text = AmbleClient.Admin.AccountMgr.AccountMgr.GetNameById(so.approverId.Value);
            }
            if (so.approveDate != null)
            {
                tbApproveDate.Text = so.approveDate.Value.ToShortDateString();
            }
             dateTimePicker1.Value = so.orderDate;
            tbCustomerPo.Text = so.customerPo;
            tbPaymentTerm.Text = so.paymentTerm;
            tbFreightTerm.Text = so.freightTerm;
            tbCustomerAccount.Text = so.customerAccount;
            tbSpecialInstructions.Text = so.specialInstructions;
            tbBillto.Text = so.billTo;
            tbShipTo.Text = so.shipTo;
            //Fill the sales ID

            FillTheSalesComboBox();
            if (mySubs.Contains(so.salesId))
            {
                 cbSp.SelectedIndex = mySubs.IndexOf(so.salesId);
            }
            else
            {
                cbSp.Items.Clear();
                cbSp.Items.Add(Admin.AccountMgr.AccountMgr.GetNameById(so.salesId));
                cbSp.SelectedIndex = 0;

            }

            GetSoItems();

            ShowDataInDataGridView();

            if (mySubs.Contains(so.salesId))
            {
                btAdd.Enabled = true;
                btDelete.Enabled = true;
                btSplit.Enabled = true;
            }
            else
            {
                btAdd.Enabled = false;
                btDelete.Enabled = false;
                btSplit.Enabled = false;
            }

            if (so.soStates != (int)SoStatesEnum.New)
            {
                btAdd.Enabled = false;
            }
            else
            {
                btAdd.Enabled = true;
            }
        }
Exemplo n.º 9
0
 public SoView(So so)
 {
     InitializeComponent();
     soList = new List<So>();
     soList.Add(so);
 }
Exemplo n.º 10
0
        public static void SaveSoDocx(So so, List<SoItemsContentAndState> soitemsList)
        {
            document = DocX.Load(@"SoDocx.dll");
               Formatting format = new Formatting();
               format.FontFamily = new System.Drawing.FontFamily("Arial");
               format.Size = 9;
               Table soTable = document.Tables[0];

               soTable.Rows[0].Cells[1].Paragraphs[0].InsertText(so.customerName, false, format);
               soTable.Rows[0].Cells[3].Paragraphs[0].InsertText(Tool.Get6DigitalNumberAccordingToId(so.soId), false, format);
               soTable.Rows[1].Cells[3].Paragraphs[0].InsertText((so.orderDate.Year + "-" + so.orderDate.Month + "-" + so.orderDate.Day).ToString(), false, format);
               soTable.Rows[2].Cells[3].Paragraphs[0].InsertText(so.paymentTerm, false, format);
               soTable.Rows[3].Cells[1].Paragraphs[0].InsertText(so.contact, false, format);
               soTable.Rows[3].Cells[3].Paragraphs[0].InsertText(so.freightTerm, false, format);
               soTable.Rows[4].Cells[1].Paragraphs[0].InsertText(AllAccountInfo.GetNameAccordingToId(UserInfo.UserId), false, format);

               custvendorinfo custven=CustVenInfoManager.GetUniqueCustVenInfo(0, so.customerName, UserInfo.UserId);

               if (custven != null)
               {
               soTable.Rows[1].Cells[1].Paragraphs[0].InsertText(custven.phone1, false, format);
               soTable.Rows[2].Cells[1].Paragraphs[0].InsertText(custven.fax, false, format);

               }

               Table itemTable = document.Tables[1];
               if(soitemsList.Count > 2)
               {
               Row sampleRow = itemTable.Rows[2];
               for (int i = 0; i < soitemsList.Count - 2; i++)
               {
                   itemTable.InsertRow(sampleRow,2);
               }
               }
               float totalAmount=0;
               for (int i = 0; i < soitemsList.Count;i++ )
               {
               itemTable.Rows[i + 2].Cells[0].Paragraphs[0].InsertText((i + 1).ToString(),false,format);
               itemTable.Rows[i + 2].Cells[1].Paragraphs[0].InsertText(soitemsList[i].soitem.partNo, false, format);
               itemTable.Rows[i + 2].Cells[2].Paragraphs[0].InsertText(soitemsList[i].soitem.mfg,false,format);
               itemTable.Rows[i + 2].Cells[3].Paragraphs[0].InsertText(soitemsList[i].soitem.qty.ToString(),false,format);
              // itemTable.Rows[i+2].Cells[4].InsertParagraph(soitemsList[i].soitem.
               if (soitemsList[i].soitem.currencyType == (int)Currency.USD)
               {
                   itemTable.Rows[i + 2].Cells[5].Paragraphs[0].InsertText(soitemsList[i].soitem.unitPrice.ToString(),false,format);
                   itemTable.Rows[i + 2].Cells[6].Paragraphs[0].InsertText((soitemsList[i].soitem.unitPrice * soitemsList[i].soitem.qty).ToString(),false,format);

               }
               else
               {
                   itemTable.Rows[i + 2].Cells[5].Paragraphs[0].InsertText(soitemsList[i].soitem.unitPrice.ToString() + Enum.GetName(typeof(Currency), soitemsList[i].soitem.currencyType),false,format);
                   itemTable.Rows[i + 2].Cells[6].Paragraphs[0].InsertText((soitemsList[i].soitem.unitPrice * soitemsList[i].soitem.qty).ToString() + Enum.GetName(typeof(Currency), soitemsList[i].soitem.currencyType),false,format);
               }
               totalAmount += soitemsList[i].soitem.unitPrice * soitemsList[i].soitem.qty;
               }
               itemTable.Rows[itemTable.Rows.Count - 1].Cells[4].Paragraphs[0].InsertText(totalAmount.ToString(),false,format);
               WriteToFile();
        }