private void searchNoArrived()
        {
            this.lcOrderCode.Text     = orderModel.OrderCode;
            this.lcCreater.Text       = orderModel.CreateUserName.Trim();
            this.lcCreateTime.Text    = orderModel.CreateDate;
            this.lcSaler.Text         = orderModel.SalerName;
            this.lcPurchaseState.Text = orderModel.OrderState;
            this.lcModifyer.Text      = orderModel.ModifyUserName;
            this.lcModifyTime.Text    = orderModel.ModifyDate;
            this.lcSender.Text        = orderModel.SenderName;
            this.lcTotal.Text         = SetNumFormat(orderModel.Total_sum) + "元";;
            this.lcSalerPeople.Text   = orderModel.SalerApproverName;
            this.lcAffirmTiem.Text    = orderModel.SalerApproveDate;
            this.lcBuyerRemark.Text   = orderModel.BuyerRemark;
            this.lcTotalFinish.Text   = SetNumFormat(orderModel.Over_sum) + "元";
            this.lcSalerRemark.Text   = orderModel.SalerRemark;

            this.rtbRemarkA.Text = orderModel.BuyerRemark;

            int     rows = 0;
            DataSet ds   = null;

            ds = BuyerOrderOfflineBLL.GetInstance().GetNoArriveList(orderModel, input, out rows);



            this.bindingSourceNoArrive.DataSource = null;
            this.bindingSourceNoArrive.DataSource = ds.Tables[0];
        }
        private void simpleButton8_Click(object sender, EventArgs e)
        {
            if (input == null)
            {
                input          = new BuyerOrderModel();
                input.UserId   = base.CurrentUserId;
                input.UserName = base.CurrentUserName;
                input.SalerId  = base.CurrentUserRegOrgId;
                input.AreaId   = base.CurrentUserSingleRegionId;
                input.OrderId  = orderModel.Id;
                input.Remark   = this.rtbRemarkA.Text;
            }



            //离线
            if (BuyerOrderOfflineBLL.GetInstance().SaveRemark(input))
            {
                XtraMessageBox.Show("保存成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            ClientSession.GetInstance()["remark"] = input.Remark;
        }
        private void btnCloseOrder_Click(object sender, EventArgs e)
        {
            try
            {
                if (input != null)
                {
                    input.List.Clear();
                }
                else
                {
                    input          = new BuyerOrderModel();
                    input.UserId   = base.CurrentUserId;
                    input.UserName = base.CurrentUserName;
                    input.SalerId  = base.CurrentUserRegOrgId;
                    input.AreaId   = base.CurrentUserSingleRegionId;
                    input.OrderId  = orderModel.Id;
                    input.Remark   = this.rtbRemarkA.Text;
                }
                int rowCount = 0;
                for (int i = 0; i < gridView3.RowCount; i++)
                {
                    DataRow row = gridView3.GetDataRow(i);
                    if (row["chk"] != null && row["chk"].ToString() == "1")
                    {
                        rowCount++;
                    }
                }
                if (rowCount < 1)
                {
                    XtraMessageBox.Show("请选择记录后再进行操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }


                for (int i = 0; i < gridView3.RowCount; i++)
                {
                    DataRow row = gridView3.GetDataRow(i);
                    if (row["chk"] != null && row["chk"].ToString() == "1")
                    {
                        OrderItemModel item = new OrderItemModel();
                        item.StockupId     = row["Stockup_Id"].ToString();
                        item.Order_item_id = row["id"].ToString();
                        item.RequestQty    = row["Request_Qty"].ToString();
                        item.LotNo         = row["Lot_No"].ToString();
                        item.ReceiveQty    = row["Receive_Qty"].ToString();

                        item.BuyerId        = row["buyer_Id"].ToString();
                        item.BuyerName      = row["buyer_Name"].ToString();
                        item.BuyerNameAbbr  = row["buyer_Name_Abbr"].ToString();
                        item.SalerId        = row["saler_Id"].ToString();
                        item.SalerName      = row["saler_Name"].ToString();
                        item.SalerNameAbbr  = row["saler_Name_Abbr"].ToString();
                        item.SenderId       = row["sender_Id"].ToString();
                        item.SenderName     = row["sender_Name"].ToString();
                        item.SenderNameAbbr = row["sender_Name_Abbr"].ToString();
                        item.ManuId         = row["MANUFACTURE_ID"].ToString();
                        item.ManuName       = row["MANUFACTURE_NAME"].ToString();
                        item.ManuNameAbbr   = row["MANUFACTURE_NAME_ABBR"].ToString();

                        item.ProductName      = row["product_Name"].ToString();
                        item.ProductCode      = row["product_Code"].ToString();
                        item.Spec_id          = row["spec_id"].ToString();
                        item.Model_id         = row["model_id"].ToString();
                        item.Spec             = row["spec"].ToString();
                        item.Model            = row["model"].ToString();
                        item.CommonName       = row["common_Name"].ToString();
                        item.Brand            = row["brand"].ToString();
                        item.BaseMeasureSpec  = row["base_Measure_Spec"].ToString();
                        item.BaseMeasureMater = row["base_Measure_Mater"].ToString();
                        item.BaseMeasure      = row["base_Measure"].ToString();
                        item.Send_measure_ex  = row["send_measure_ex"].ToString();
                        item.Send_measure     = row["send_measure"].ToString();


                        item.ProductId          = row["PROJECT_PROD_ID"].ToString();
                        item.TradePrice         = row["trade_Price"].ToString();
                        item.RetailPrice        = row["RETAIL_PRICE"].ToString();
                        item.Project_id         = row["project_id"].ToString();
                        item.Project_product_id = row["PROJECT_PROD_ID"].ToString();
                        item.Pbno            = row["Pbno"].ToString();
                        item.Send_batch_no   = row["Send_batch_no"].ToString();
                        item.Store_room_id   = row["store_room_id"].ToString();
                        item.Store_room_name = row["store_room_name"].ToString();


                        input.List.Add(item);
                    }
                }
                //end modify

                BuyerOrderOfflineBLL.GetInstance().CloseOrderItem(input);

                int     rows;
                DataSet ds = null;

                ds = BuyerOrderOfflineBLL.GetInstance().GetNoArriveList(orderModel, input, out rows);

                this.bindingSourceNoArrive.DataSource = null;
                this.bindingSourceNoArrive.DataSource = ds.Tables[0];

                //string overSum = BuyerOrderOfflineDAO.GetInstance().GetOrderOverSum(input.OrderId);
                //orderModel.Over_sum = overSum;

                string state = BuyerOrderOfflineDAO.GetInstance().GetOrderState(input.OrderId);
                orderModel.OrderState = state;

                this.lcPurchaseState.Text = orderModel.OrderState;
                //this.lcTotalFinish.Text = SetNumFormat(orderModel.Over_sum) + "元";
            }
            catch (Exception ex)
            {
                throw ex;
            }

            XtraMessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void btnAffirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (input != null)
                {
                    input.List.Clear();
                }
                else
                {
                    input          = new BuyerOrderModel();
                    input.UserId   = base.CurrentUserId;
                    input.UserName = base.CurrentUserName;
                    input.SalerId  = base.CurrentUserRegOrgId;
                    input.AreaId   = base.CurrentUserSingleRegionId;
                    input.OrderId  = orderModel.Id;
                    input.Remark   = this.rtbRemarkA.Text;
                    input.HighId   = ClientSession.GetInstance().CurrentUser.HighId;;
                }

                int rowCount = 0;
                for (int i = 0; i < gridView3.RowCount; i++)
                {
                    DataRow row = gridView3.GetDataRow(i);
                    if (row["chk"] != null && row["chk"].ToString() == "1")
                    {
                        rowCount++;
                    }
                }
                if (rowCount < 1)
                {
                    XtraMessageBox.Show("请选择记录后再进行操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                //if (!checkInput())
                //    return;


                for (int i = 0; i < gridView3.RowCount; i++)
                {
                    DataRow row = gridView3.GetDataRow(i);
                    if (row["chk"] != null && row["chk"].ToString() == "1")
                    {
                        OrderItemModel item = new OrderItemModel();
                        item.StockupId     = row["Stockup_Id"].ToString();
                        item.RequestQty    = row["Request_Qty"].ToString();
                        item.LotNo         = row["Lot_No"].ToString();
                        item.ReceiveQty    = row["Receive_Qty"].ToString();
                        item.Order_item_id = row["id"].ToString();
                        item.ProductId     = row["Product_Id"].ToString();
                        //item.Amount = row["amount"].ToString();
                        //item.Discount = dgvNoArrive.Rows[i].Cells["discount"].Value.ToString();
                        //item.InvoiceDate = dgvNoArrive.Rows[i].Cells["invoiceDate"].Value.ToString();
                        //item.InvoiceExpireDate = dgvNoArrive.Rows[i].Cells["invoiceExpireDate"].Value.ToString();
                        //item.InvoiceNo = dgvNoArrive.Rows[i].Cells["invoiceNo"].Value.ToString();
                        //item.ReceiveRemark = dgvNoArrive.Rows[i].Cells["receiveRemark"].Value.ToString();
                        //item.RepositoryId = dgvNoArrive.Rows[i].Cells["repositoryId"].Value.ToString();
                        item.RetailPrice        = row["RETAIL_PRICE"].ToString();
                        item.TradePrice         = row["trade_Price"].ToString();
                        item.Project_id         = row["project_id"].ToString();
                        item.Project_product_id = row["project_prod_id"].ToString();
                        item.Pbno            = row["pbno"].ToString();
                        item.Send_batch_no   = row["send_batch_no"].ToString();
                        item.Store_room_id   = row["store_room_id"].ToString();
                        item.Store_room_name = row["store_room_name"].ToString();


                        item.BuyerId        = row["buyer_Id"].ToString();
                        item.BuyerName      = row["buyer_Name"].ToString();
                        item.BuyerNameAbbr  = row["buyer_Name_Abbr"].ToString();
                        item.SalerId        = row["saler_Id"].ToString();
                        item.SalerName      = row["saler_Name"].ToString();
                        item.SalerNameAbbr  = row["saler_Name_Abbr"].ToString();
                        item.SenderId       = row["sender_Id"].ToString();
                        item.SenderName     = row["sender_Name"].ToString();
                        item.SenderNameAbbr = row["sender_Name_Abbr"].ToString();
                        item.ManuId         = row["MANUFACTURE_ID"].ToString();
                        item.ManuName       = row["MANUFACTURE_NAME"].ToString();
                        item.ManuNameAbbr   = row["MANUFACTURE_NAME_ABBR"].ToString();

                        item.ProductName      = row["product_Name"].ToString();
                        item.ProductCode      = row["product_Code"].ToString();
                        item.Spec_id          = row["spec_id"].ToString();
                        item.Model_id         = row["model_id"].ToString();
                        item.Spec             = row["spec"].ToString();
                        item.Model            = row["model"].ToString();
                        item.CommonName       = row["common_Name"].ToString();
                        item.Brand            = row["brand"].ToString();
                        item.BaseMeasureSpec  = row["base_Measure_Spec"].ToString();
                        item.BaseMeasureMater = row["base_Measure_Mater"].ToString();
                        item.BaseMeasure      = row["base_Measure"].ToString();
                        item.Send_measure_ex  = row["send_measure_ex"].ToString();
                        item.Send_measure     = row["send_measure"].ToString();


                        item.ProductId = row["PROJECT_PROD_ID"].ToString();

                        item.RetailPrice        = row["RETAIL_PRICE"].ToString();
                        item.Project_id         = row["project_id"].ToString();
                        item.Project_product_id = row["PROJECT_PROD_ID"].ToString();
                        item.Pbno            = row["Pbno"].ToString();
                        item.Send_batch_no   = row["Send_batch_no"].ToString();
                        item.Store_room_id   = row["store_room_id"].ToString();
                        item.Store_room_name = row["store_room_name"].ToString();


                        input.List.Add(item);
                    }
                }

                BuyerOrderOfflineBLL.GetInstance().ArrivedConfirm(input);

                int     rows;
                DataSet ds = null;

                ds = BuyerOrderOfflineBLL.GetInstance().GetNoArriveList(orderModel, input, out rows);

                string overSum = BuyerOrderOfflineDAO.GetInstance().GetOrderOverSum(input.OrderId);
                orderModel.Over_sum = overSum;

                string state = BuyerOrderOfflineDAO.GetInstance().GetOrderState(input.OrderId);
                orderModel.OrderState = state;

                this.lcPurchaseState.Text = orderModel.OrderState;

                this.lcTotalFinish.Text = SetNumFormat(orderModel.Over_sum) + "元";

                input.Rows = rows;

                this.bindingSourceNoArrive.DataSource = null;
                this.bindingSourceNoArrive.DataSource = ds.Tables[0];

                //string temp = string.Empty;
                //string state = string.Empty;

                //    temp = BuyerOrderOfflineBLL.GetInstance("ClientDB").GetReceiveTotalByOrder(input);
                //    state = BuyerOrderOfflineBLL.GetInstance("ClientDB").GetOrderState(input);

                //this.orderTitle.lblReceive.Text = temp.Trim() + "(元)";
                //this.orderTitle.lblState.Text = state;

                if (ds.Tables[0].Rows.Count == 0)
                {
                    this.rtbRemarkA.Text = "";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            XtraMessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }