예제 #1
0
    protected void AddEmptyDetail()
    {
        SaveGrid();

        ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>;

        for (int i = 0; i < 5; i++)
        {
            ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;

            FNA_FeeWriteOffDetail item;

            item = new FNA_FeeWriteOffDetail();
            item.AccountTitle = 1;
            item.ApplyCost    = 0;
            item.WriteOffCost = 0;
            item.ID           = (int)ViewState["MaxID"];

            #region 获取当前会计月的开始及截止日期
            int             month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-7));
            AC_AccountMonth m     = new AC_AccountMonthBLL(month).Model;
            item.BeginMonth = m.ID;
            item.EndMonth   = m.ID;
            item.BeginDate  = m.BeginDate;
            item.EndDate    = m.EndDate;
            #endregion

            item.Remark = "";
            _details.Add(item);             //新增科目
        }
        BindGrid();
    }
예제 #2
0
        private IValue PushEnd(List <IValue> arguments, Scope s)
        {
            ListTable left = (ListTable)arguments[0];

            foreach (IValue val in arguments.Skip(1))
            {
                left.Add(val);
            }

            return(left);
        }
예제 #3
0
        //TODO return lazy enumeration?
        public override IValue ConvertToIValue(IEnumerable original)
        {
            if (original == null)
            {
                return(Value.Nil);
            }
            var values = new ListTable();

            foreach (var value in original)
            {
                values.Add(Framework.ConvertToIValue(value));
            }
            return(values);
        }
예제 #4
0
    public DataSQL(string tableName, string ConnectKey = "TVSConn")
    {
        this.ConnectKey = ConnectKey;

        if (!ListTable.ContainsKey(tableName))
        {
            tableInfo = getTableInfo(tableName);
            try
            {
                ListTable.Add(tableName, tableInfo);
            }
            catch { }
        }
        else
        {
            tableInfo = (TableInfo)ListTable[tableName];
        }
    }
 /// <summary>
 /// 学习规律
 /// </summary>
 private void Learn()
 {
     string[] allLines = File.ReadAllLines("Init\\Corpus_QuestionTypeChecker.txt", Encoding.UTF8);
     foreach (string line in allLines)
     {
         string[] context = line.Split(new[] { ',' }, StringSplitOptions.None);
         if (context.Length == 8)
         {
             for (int i = 1; i < 8; i++)
             {
                 if (context[i] == "True")
                 {
                     _questionRules.Add(context[0], types[i - 1]);
                 }
             }
         }
     }
 }
예제 #6
0
    protected void btn_Save_Recipients_Click(object sender, EventArgs e)
    {
        ListTable <EWF_Flow_ProcessJointDecision_Recipients> items = (ListTable <EWF_Flow_ProcessJointDecision_Recipients>)ViewState["Details"];
        EWF_Flow_ProcessJointDecision_Recipients             m;

        if (ViewState["SelectedRecipientRole"] == null)
        {
            m = new EWF_Flow_ProcessJointDecision_Recipients();
        }
        else
        {
            m = items[ViewState["SelectedRecipientRole"].ToString()];
        }

        m.Process       = (Guid)ViewState["ProcessID"];
        m.RecipientRole = new Guid(ddl_RecipientRole_Decision.SelectedValue);
        m.DataObject    = new Guid(ddl_DataObject_Decision.SelectedValue);
        m.Remark        = tbx_Recipients_Remark.Text;

        if (m.RecipientRole == Guid.Empty)
        {
            MessageBox.Show(this, "请正确选择参与会审人员角色!");
            return;
        }

        if (ddl_DataObject_Decision.Enabled && m.DataObject == Guid.Empty)
        {
            MessageBox.Show(this, "请正确选择参与会审人员角色关联的数据对象!");
            return;
        }

        if (ViewState["SelectedRecipientRole"] == null)
        {
            items.Add(m);
        }
        else
        {
            items.Update(m);
            ViewState["SelectedRecipientRole"] = null;
            btn_Save_Recipients.Text           = "添加会审角色";
        }
        BindGrid();
    }
예제 #7
0
    protected void bt_AddToDeliveryList_Click(object sender, EventArgs e)
    {
        if (tr_OrganizeCity.SelectValue == "0")
        {
            MessageBox.Show(this, "必须选择管理片区才能点添加");
            return;
        }

        tr_OrganizeCity.Enabled = false;     //开始添加报销后,不允许选择其他的管理片区,保证所有的费用明细都来源于一个管理片区

        ListTable <ORD_OrderDeliveryDetail> _details = ViewState["Details"] as ListTable <ORD_OrderDeliveryDetail>;

        foreach (GridViewRow row in gv_OrderAplyList.Rows)
        {
            CheckBox cb_Selected = (CheckBox)row.FindControl("cb_Selected");
            if (cb_Selected.Checked)
            {
                int applyid       = (int)gv_OrderAplyList.DataKeys[row.RowIndex][0];
                int applydetialid = (int)gv_OrderAplyList.DataKeys[row.RowIndex][1];


                ORD_OrderApplyBLL    applyBLL    = new ORD_OrderApplyBLL(applyid);
                ORD_OrderApplyDetail applydetail = applyBLL.GetDetailModel(applydetialid);

                ORD_OrderDeliveryDetail m = new ORD_OrderDeliveryDetail();

                m.ApplyDetailID    = applydetialid;
                m.Client           = applyBLL.Model.Client;
                m.Product          = applydetail.Product;
                m.Price            = applydetail.Price;
                m.FactoryPrice     = m.FactoryPrice == 0 ? applydetail.Price : m.FactoryPrice;
                m.DeliveryQuantity = applydetail.BookQuantity + applydetail.AdjustQuantity - applydetail.DeliveryQuantity;
                m.SignInQuantity   = m.DeliveryQuantity;

                _details.Add(m);
            }
        }
        bNoDelivery = true;
        BindGrid();
        gv_OrderAplyList.PageIndex = 0;
        BindOrderApplyCanDelivery();
    }
예제 #8
0
    protected void bt_AddDetail_Click(object sender, EventArgs e)
    {
        if (Session["SuccessFlag"] != null && Session["FeeApplyDetail"] != null && (bool)Session["SuccessFlag"])
        {
            ListTable <FNA_FeeApplyDetail> _details    = ViewState["Details"] as ListTable <FNA_FeeApplyDetail>;
            ListTable <FNA_FeeApplyDetail> _newdetails = (ListTable <FNA_FeeApplyDetail>)Session["FeeApplyDetail"];

            #region 费用申请时,是否可以在一个申请单中申请多家店面费用
            try
            {
                if (!ConfigHelper.GetConfigBool("FeeApplyMutiClientsFee"))
                {
                    if (_details.GetListItem().Count > 0 && _newdetails.GetListItem().Count > 0)
                    {
                        if (_details.GetListItem()[0].Client != _newdetails.GetListItem()[0].Client)
                        {
                            Session["FeeApplyDetail"] = null;
                            Session["SuccessFlag"]    = null;

                            MessageBox.Show(this, "对不起,一份申请单只能申请同一个客户的费用科目申请!");
                            return;
                        }
                    }
                }
            }
            catch { }
            #endregion

            foreach (FNA_FeeApplyDetail item in _newdetails.GetListItem())
            {
                ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;
                item.ID            = (int)ViewState["MaxID"];
                _details.Add(item);
            }

            Session["FeeApplyDetail"] = null;
            Session["SuccessFlag"]    = null;

            BindGrid();
        }
    }
예제 #9
0
    protected void AddEmptyDetail()
    {
        SaveGrid();

        ListTable <FNA_FeeApplyDetail> _details = ViewState["Details"] as ListTable <FNA_FeeApplyDetail>;

        for (int i = 0; i < 5; i++)
        {
            ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;

            FNA_FeeApplyDetail item;

            item = new FNA_FeeApplyDetail();
            item.AccountTitle = 1;
            item.ApplyCost    = 0;
            item.ID           = (int)ViewState["MaxID"];

            #region 获取当前会计月的开始及截止日期
            int month = (int)ViewState["AccountMonth"];
            if (month == 0)
            {
                month = AC_AccountMonthBLL.GetCurrentMonth();
            }
            AC_AccountMonth m = new AC_AccountMonthBLL(month).Model;
            item.BeginDate  = m.BeginDate;
            item.EndDate    = m.EndDate;
            item.BeginMonth = month;
            item.EndMonth   = month;
            #endregion

            item.Flag   = 1;                //未报销
            item.Remark = "";
            _details.Add(item);             //新增科目
        }
        BindGrid();
    }
예제 #10
0
    protected void bt_AddDetail_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] == 0)
        {
            return;
        }
        PBM_OrderBLL _bll = new PBM_OrderBLL((int)ViewState["ID"]);

        if (ViewState["Details"] == null)
        {
            return;
        }
        ListTable <PBM_OrderDetail> Details = (ListTable <PBM_OrderDetail>)ViewState["Details"];

        int product = 0;

        int.TryParse(select_Product.SelectValue, out product);
        //int.TryParse(RadComboBox1.SelectedValue, out product);
        if (product != 0)
        {
            PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
            if (productbll.Model == null)
            {
                return;
            }
            if (productbll.Model.ConvertFactor == 0)
            {
                productbll.Model.ConvertFactor = 1;
                productbll.Update();
            }

            int     quantity = 0;
            decimal price    = 0;

            int.TryParse(tbx_Quantity.Text, out quantity);
            decimal.TryParse(tbx_Price.Text, out price);

            if (ddl_Unit.SelectedValue == "T")
            {
                //整件单位
                quantity = quantity * productbll.Model.ConvertFactor;
                price    = price / productbll.Model.ConvertFactor;
            }

            if (quantity == 0)
            {
                MessageBox.Show(this, "请填写数量!");
                return;
            }

            PBM_OrderDetail d = null;

            if (ViewState["SelectedDetail"] != null)
            {
                d = (PBM_OrderDetail)ViewState["SelectedDetail"];
            }
            else
            {
                d         = new PBM_OrderDetail();
                d.OrderID = (int)ViewState["ID"];

                if (Details.GetListItem().Count == 0)
                {
                    d.ID = 1;
                }
                else
                {
                    d.ID = Details.GetListItem().Max(p => p.ID) + 1;
                }
            }

            d.Product           = product;
            d.Price             = price;        //实际销售价
            d.DiscountRate      = 1;            //默认全价
            d.ConvertFactor     = productbll.Model.ConvertFactor;
            d.BookQuantity      = quantity;
            d.ConfirmQuantity   = quantity;
            d.DeliveredQuantity = 0;
            d.SalesMode         = int.Parse(ddl_SalesMode.SelectedValue);
            if (d.SalesMode == 2)
            {
                d.Price = 0;
            }

            if (ViewState["SelectedDetail"] != null)
            {
                Details.Update(d);
                ViewState["SelectedDetail"] = null;
                bt_AddDetail.Text           = "新 增";
                gv_List.SelectedIndex       = -1;
            }
            else
            {
                Details.Add(d);
            }

            tbx_Quantity.Text = "0";

            BindGrid();
        }
    }
    protected void bt_AddDetail_Click(object sender, EventArgs e)
    {
        ListTable <CM_ContractDetail> _details = ViewState["Details"] as ListTable <CM_ContractDetail>;

        DateTime begindate     = new DateTime();
        DateTime enddate       = new DateTime();
        TextBox  tbx_BeginDate = pl_detail.FindControl("CM_Contract_BeginDate") == null ? null : (TextBox)pl_detail.FindControl("CM_Contract_BeginDate");
        TextBox  tbx_EndDate   = pl_detail.FindControl("CM_Contract_EndDate") == null ? null : (TextBox)pl_detail.FindControl("CM_Contract_EndDate");

        if (tbx_BeginDate != null && tbx_EndDate != null)
        {
            DateTime.TryParse(tbx_BeginDate.Text, out begindate);
            DateTime.TryParse(tbx_EndDate.Text, out enddate);
            if (enddate < begindate)
            {
                MessageBox.Show(this, "协议终止日期不能小于起始日期。");
                return;
            }
        }

        if (ddl_PayMode.SelectedValue == "0")
        {
            MessageBox.Show(this, "付款周期必选!");
            return;
        }


        CM_ContractDetail item;

        if (ViewState["Selected"] == null)
        {
            //新增科目
            if (_details.Contains(ddl_AccountTitle.SelectedValue))
            {
                MessageBox.Show(this, "该科目已添加!");
                return;
            }

            item = new CM_ContractDetail();
            item.AccountTitle = int.Parse(ddl_AccountTitle.SelectedValue);
            if (TreeTableBLL.GetChild("MCS_PUB.dbo.AC_AccountTitle", "ID", "SuperID", item.AccountTitle).Rows.Count > 0)
            {
                MessageBox.Show(this, "费用科目必须选择最底级会计科目!" + ddl_AccountTitle.SelectedItem.Text);
                return;
            }
        }
        else
        {//修改科目
            if (!_details.Contains(ddl_AccountTitle.SelectedValue))
            {
                MessageBox.Show(this, "要修改的项目不存在!");
                return;
            }
            item = _details[ViewState["Selected"].ToString()];
        }
        item.ApplyLimit = decimal.Parse(tbx_ApplyLimit.Text);
        if (item.ApplyLimit == 0)
        {
            MessageBox.Show(this, "对不起,月费用金额不能为0!");
            return;
        }
        item.PayMode = int.Parse(ddl_PayMode.SelectedValue);

        if (ViewState["Selected"] == null)
        {
            _details.Add(item);
        }
        else
        {
            _details.Update(item);
        }

        BindGrid();

        tbx_ApplyLimit.Text   = "0";
        bt_AddDetail.Text     = "新增";
        ViewState["Selected"] = null;
    }
    protected void bt_AddDefineDataObject_Click(object sender, EventArgs e)
    {
        ListTable <EWF_Flow_DataObject> lt = (ListTable <EWF_Flow_DataObject>)ViewState["ListTable"];

        #region 寻找最大排序ID号
        int maxsortid = 0;
        foreach (EWF_Flow_DataObject item in lt.GetListItem())
        {
            if (maxsortid < item.SortID)
            {
                maxsortid = item.SortID;
            }
        }
        #endregion


        foreach (ListItem listitem in cbx_PreDefineDO.Items)
        {
            if (!listitem.Selected)
            {
                continue;
            }
            maxsortid++;
            EWF_Flow_DataObject item;
            switch (listitem.Value)
            {
            case "Position":
                #region 职位
                item                       = new EWF_Flow_DataObject();
                item["App"]                = ViewState["AppID"].ToString();
                item["Name"]               = "Position";
                item["DisplayName"]        = "发起人职位";
                item["DataType"]           = "1"; //整形数值
                item["ReadOnly"]           = "N";
                item["Enable"]             = "Y";
                item["Visible"]            = "Y";
                item["ControlType"]        = "1";
                item["ColSpan"]            = "2";
                item["SortID"]             = maxsortid.ToString();
                item["IsRequireField"]     = "N";
                item["RelationType"]       = "2";
                item["RelationTableName"]  = "MCS_SYS.dbo.Org_Position";
                item["RelationValueField"] = "ID";
                item["RelationTextField"]  = "Name";

                lt.Add(item);
                break;

                #endregion
            case "OrganizeCity":
                #region 当前管理片区
                item                       = new EWF_Flow_DataObject();
                item["App"]                = ViewState["AppID"].ToString();
                item["Name"]               = "OrganizeCityID";
                item["DisplayName"]        = "当前管理片区";
                item["DataType"]           = "1"; //整形数值
                item["ReadOnly"]           = "N";
                item["Enable"]             = "N";
                item["Visible"]            = "Y";
                item["ControlType"]        = "1";
                item["ColSpan"]            = "2";
                item["SortID"]             = maxsortid.ToString();
                item["IsRequireField"]     = "N";
                item["RelationType"]       = "2";
                item["RelationTableName"]  = "MCS_SYS.dbo.Addr_OrganizeCity";
                item["RelationValueField"] = "ID";
                item["RelationTextField"]  = "Name";

                lt.Add(item);

                item                   = new EWF_Flow_DataObject();
                item["App"]            = ViewState["AppID"].ToString();
                item["Name"]           = "OrganizeCityName";
                item["DisplayName"]    = "管理片区名称";
                item["DataType"]       = "1";   //整形数值
                item["ReadOnly"]       = "N";
                item["Enable"]         = "N";
                item["Visible"]        = "N";
                item["ControlType"]    = "1";
                item["ColSpan"]        = "2";
                item["SortID"]         = maxsortid.ToString();
                item["IsRequireField"] = "N";
                item["RelationType"]   = "3";

                lt.Add(item);
                break;

                #endregion
            case "OfficeCity":
                #region 所属办事处
                item                   = new EWF_Flow_DataObject();
                item["App"]            = ViewState["AppID"].ToString();
                item["Name"]           = "OfficeCityID";
                item["DisplayName"]    = "所属办事处ID";
                item["DataType"]       = "1";   //整形数值
                item["ReadOnly"]       = "N";
                item["Enable"]         = "N";
                item["Visible"]        = "N";
                item["ControlType"]    = "1";
                item["ColSpan"]        = "2";
                item["SortID"]         = maxsortid.ToString();
                item["IsRequireField"] = "N";
                item["RelationType"]   = "3";
                lt.Add(item);

                item                   = new EWF_Flow_DataObject();
                item["App"]            = ViewState["AppID"].ToString();
                item["Name"]           = "OfficeCityName";
                item["DisplayName"]    = "所属办事处名称";
                item["DataType"]       = "1";   //整形数值
                item["ReadOnly"]       = "N";
                item["Enable"]         = "N";
                item["Visible"]        = "Y";
                item["ControlType"]    = "1";
                item["ColSpan"]        = "2";
                item["SortID"]         = maxsortid.ToString();
                item["IsRequireField"] = "N";
                item["RelationType"]   = "3";

                lt.Add(item);
                break;

                #endregion
            case "Remark":
                #region 备注
                item                   = new EWF_Flow_DataObject();
                item["App"]            = ViewState["AppID"].ToString();
                item["Name"]           = "Remark";
                item["DisplayName"]    = "备注";
                item["DataType"]       = "3";   //整形数值
                item["ReadOnly"]       = "N";
                item["Enable"]         = "N";
                item["Visible"]        = "Y";
                item["ControlType"]    = "5";
                item["ColSpan"]        = "3";
                item["SortID"]         = maxsortid.ToString();
                item["IsRequireField"] = "N";
                item["RelationType"]   = "3";
                item["ControlWidth"]   = "500";
                item["ControlHeight"]  = "60";
                lt.Add(item);
                break;
                #endregion
            }
        }
        tbx_SortID.Text = maxsortid.ToString();
        BindGrid();
    }
예제 #13
0
    protected void bt_AddProduct_Click(object sender, EventArgs e)
    {
        #region 验证必填项
        if (ViewState["Product"] == null || (int)ViewState["Product"] == 0)
        {
            lb_ErrInfo1.Text = "产品必填!";
            return;
        }

        #endregion

        ListTable <PDT_ProductPrice_Detail> _details = ViewState["Details"] as ListTable <PDT_ProductPrice_Detail>;

        PDT_ProductPrice_Detail item;

        #region 产品存在与否判断
        if (ViewState["Selected"] == null)
        {
            //新增产品
            if (_details.Contains(ViewState["Product"].ToString()))
            {
                lb_ErrInfo1.Text = "该产品已添加!";
                return;
            }

            item         = new PDT_ProductPrice_Detail();
            item.Product = (int)ViewState["Product"];
        }
        else
        {
            //修改科目
            if (!_details.Contains(ViewState["Product"].ToString()))
            {
                lb_ErrInfo1.Text = "要修改的产品不存在!";
                return;
            }
            item = _details[ViewState["Selected"].ToString()];

            select_ProductCode.Enabled = true;
            gv_List.SelectedIndex      = -1;
        }
        #endregion

        lb_ProductName.ForeColor = System.Drawing.Color.Black;

        item.BuyingPrice = tbx_BuyingPrice.Text == "" ? 0 : decimal.Parse(tbx_BuyingPrice.Text);
        item.SalesPrice  = tbx_SalesPrice.Text == "" ? 0 : decimal.Parse(tbx_SalesPrice.Text);

        if (ViewState["Selected"] == null)
        {
            _details.Add(item);             //新增产品
        }
        else
        {
            _details.Update(item);          //更新产品
        }
        BindGrid();

        lb_ErrInfo1.Text     = "";
        tbx_BuyingPrice.Text = "";
        tbx_SalesPrice.Text  = "";

        ViewState["Selected"] = null;
    }
예제 #14
0
    protected void bt_AddTeleFee_Click(object sender, EventArgs e)
    {
        if (ddl_Tele.SelectedValue == "0")
        {
            return;
        }

        int teleid = int.Parse(ddl_Tele.SelectedValue);
        CM_PropertyInTelephone tele = new CM_PropertyInTelephoneBLL(teleid).Model;

        decimal writeoffcost = decimal.Parse(tbx_TeleCost.Text);
        decimal applycost    = tele.TeleCost + tele.NetCost;

        if (writeoffcost > applycost)
        {
            MessageBox.Show(this, "对不起,实际报销金额不能超过申请限额" + lb_TeleApplyCost.Text + "!");
            tbx_TeleCost.Text = lb_TeleApplyCost.Text;
            return;
        }

        SaveGrid();
        ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;

        #region 组织电话费核销明细
        FNA_FeeWriteOffDetail item = new FNA_FeeWriteOffDetail();
        item.ID           = (int)ViewState["MaxID"];
        item.AccountTitle = ConfigHelper.GetConfigInt("TeleCostACTitle");
        item.ApplyCost    = applycost;
        item.WriteOffCost = writeoffcost;

        item["TeleFeeRelateTelephone"] = tele.ID.ToString();
        item.Client = tele.Client;

        #region 获取当前会计月的开始及截止日期
        int             month = int.Parse(ddl_TeleCostMonth.SelectedValue);
        AC_AccountMonth m     = new AC_AccountMonthBLL(month).Model;
        item.BeginMonth = m.ID;
        item.EndMonth   = m.ID;
        item.BeginDate  = m.BeginDate;
        item.EndDate    = m.EndDate;
        #endregion

        if (tele.Client > 0)
        {
            CM_Client client = new CM_ClientBLL(tele.Client).Model;
            if (client != null)
            {
                item.Remark = "物业:" + client.FullName + ";";
            }
        }
        item.Remark += "电话号码:" + ddl_Tele.SelectedItem.Text + ";月份:" + ddl_TeleCostMonth.SelectedItem.Text +
                       ";限额:" + lb_TeleApplyInfo.Text + ";";

        if (tbx_TeleRemark.Text != "")
        {
            item.Remark += "说明:" + tbx_TeleRemark.Text;
        }
        #endregion

        if (FNA_FeeWriteOffBLL.CheckTeleFeeHasWriteOff(item.AccountTitle, item.BeginMonth, tele.ID))
        {
            MessageBox.Show(this, "该电话指定月的费用,已在其他报销单中报销,请勿重复报销!");
        }
        else
        {
            ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>;
            if (_details.GetListItem().FirstOrDefault(p =>
                                                      p.AccountTitle == item.AccountTitle &&
                                                      p.BeginMonth == item.BeginMonth &&
                                                      p["TeleFeeRelateTelephone"] == item["TeleFeeRelateTelephone"]) == null)
            {
                _details.Add(item);             //新增科目
            }
            else
            {
                MessageBox.Show(this, "该电话指定月的费用,已在本报销单中,请勿重复报销!");
            }
        }
        BindGrid();
        AddEmptyDetail();
    }
    protected bool bNoDelivery = false;      //未发货,界面发货数量字段可编辑

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["ID"]     = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);
            ViewState["Client"] = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            BindDropDown();

            pn_OrderDelivery.SetPanelVisible("Panel_LGS_OrderDeliveryDetail00_02", false);

            if ((int)ViewState["ID"] == 0)
            {
                if ((int)ViewState["Client"] == 0)
                {
                    return;
                }

                #region 新增发货单时,初始化界面
                CM_Client client = new CM_ClientBLL((int)ViewState["Client"]).Model;
                if (client != null)
                {
                    ViewState["OrganizeCity"] = client.OrganizeCity;
                    Label lb_Client = (Label)pn_OrderDelivery.FindControl("ORD_OrderDelivery_Client");
                    if (lb_Client != null)
                    {
                        lb_Client.Text = client.FullName;
                    }

                    MCSSelectControl select_Store = (MCSSelectControl)pn_OrderDelivery.FindControl("ORD_OrderDelivery_Store");
                    if (select_Store != null && client.Supplier != 0)
                    {
                        select_Store.SelectText  = new CM_ClientBLL(client.Supplier).Model.FullName;
                        select_Store.SelectValue = client.Supplier.ToString();
                    }

                    TextBox tbx_DeliveryTime = (TextBox)pn_OrderDelivery.FindControl("ORD_OrderDelivery_DeliveryTime");
                    if (tbx_DeliveryTime != null)
                    {
                        tbx_DeliveryTime.Text = DateTime.Today.ToString("yyyy-MM-dd");
                    }

                    TextBox tbx_PreArrivalDate = (TextBox)pn_OrderDelivery.FindControl("ORD_OrderDelivery_PreArrivalDate");
                    if (tbx_PreArrivalDate != null)
                    {
                        tbx_PreArrivalDate.Text = DateTime.Today.AddDays(1).ToString("yyyy-MM-dd");
                    }



                    bNoDelivery       = true;
                    bt_Delete.Visible = false;
                }
                #endregion

                #region 创建空的列表
                ListTable <ORD_OrderDeliveryDetail> _details = new ListTable <ORD_OrderDeliveryDetail>
                                                                   (new List <ORD_OrderDeliveryDetail>(), "Product");
                DataTable dtProduct = ORD_OrderDeliveryBLL.InitProductList((int)ViewState["Client"], 0);
                foreach (DataRow row in dtProduct.Rows)
                {
                    ORD_OrderDeliveryDetail item = new ORD_OrderDeliveryDetail();
                    item.Product          = (int)row["Product"];
                    item.FactoryPrice     = (decimal)row["FactoryPrice"];
                    item.Price            = (decimal)row["SalesPrice"];
                    item.Client           = (int)ViewState["Client"];
                    item.DeliveryQuantity = 0;
                    item.SignInQuantity   = 0;
                    item.BadQuantity      = 0;
                    item.LostQuantity     = 0;

                    _details.Add(item);
                }

                ViewState["Details"] = _details;
                #endregion

                BindGrid();
            }
            else
            {
                BindData();
            }
        }
    }
예제 #16
0
    protected void bt_AddMobileFee_Click(object sender, EventArgs e)
    {
        int staffid = 0;

        int.TryParse(select_MobileStaff.SelectValue, out staffid);
        if (staffid == 0)
        {
            return;
        }

        Org_Staff staff = new Org_StaffBLL(staffid).Model;

        if (staff == null)
        {
            return;
        }

        if (string.IsNullOrEmpty(staff["ManageInfo11"]))
        {
            staff["ManageInfo11"] = "0";
        }
        decimal applycost = 0;

        decimal.TryParse(staff["ManageInfo11"], out applycost);
        if (applycost <= 0)
        {
            return;
        }


        decimal writeoffcost = decimal.Parse(tbx_MobileCost.Text);

        if (writeoffcost > applycost)
        {
            MessageBox.Show(this, "对不起,实际报销金额不能超过申请限额" + lb_MobileApplyCost.Text + "!");
            tbx_MobileCost.Text = lb_MobileApplyCost.Text;
            return;
        }

        SaveGrid();
        ViewState["MaxID"] = (int)ViewState["MaxID"] + 1;

        #region 组织手机费核销明细
        FNA_FeeWriteOffDetail item = new FNA_FeeWriteOffDetail();
        item.ID           = (int)ViewState["MaxID"];
        item.AccountTitle = ConfigHelper.GetConfigInt("MobileCostACTitle");
        item.ApplyCost    = applycost;
        item.WriteOffCost = writeoffcost;

        item["MobileFeeRelateStaff"] = staff.ID.ToString();

        #region 获取当前会计月的开始及截止日期
        int             month = int.Parse(ddl_MobileCostMonth.SelectedValue);
        AC_AccountMonth m     = new AC_AccountMonthBLL(month).Model;
        item.BeginMonth = m.ID;
        item.EndMonth   = m.ID;
        item.BeginDate  = m.BeginDate;
        item.EndDate    = m.EndDate;
        #endregion

        item.Remark  = "员工:" + staff.RealName + ";";
        item.Remark += "手机号码:" + staff["Mobile"] + ";月份:" + ddl_MobileCostMonth.SelectedItem.Text +
                       ";限额:" + lb_MobileApplyCost.Text + ";";

        if (tbx_MobileRemark.Text != "")
        {
            item.Remark += "说明:" + tbx_MobileRemark.Text;
        }
        #endregion
        if (FNA_FeeWriteOffBLL.CheckMobileFeeHasWriteOff(item.AccountTitle, item.BeginMonth, staffid))
        {
            MessageBox.Show(this, "该员工指定月的手机费,已在其他报销单中报销,请勿重复报销!");
        }
        else
        {
            ListTable <FNA_FeeWriteOffDetail> _details = ViewState["Details"] as ListTable <FNA_FeeWriteOffDetail>;
            if (_details.GetListItem().FirstOrDefault(p =>
                                                      p.AccountTitle == item.AccountTitle &&
                                                      p.BeginMonth == item.BeginMonth &&
                                                      p["MobileFeeRelateStaff"] == item["MobileFeeRelateStaff"]) == null)
            {
                _details.Add(item);             //新增科目
            }
            else
            {
                MessageBox.Show(this, "该员工指定月的手机费,已在本报销单中,请勿重复报销!");
            }
        }
        BindGrid();
        AddEmptyDetail();
    }
예제 #17
0
    protected void bt_AddDetail_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] == 0)
        {
            return;
        }
        PBM_DeliveryBLL _bll = new PBM_DeliveryBLL((int)ViewState["ID"]);

        if (ViewState["Details"] == null)
        {
            return;
        }
        ListTable <PBM_DeliveryDetail> Details = (ListTable <PBM_DeliveryDetail>)ViewState["Details"];

        int product = 0;

        int.TryParse(select_Product.SelectValue, out product);
        //int.TryParse(RadComboBox1.SelectedValue, out product);
        if (product != 0)
        {
            PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
            if (productbll.Model == null)
            {
                return;
            }
            if (productbll.Model.ConvertFactor == 0)
            {
                productbll.Model.ConvertFactor = 1;
                productbll.Update();
            }

            string   lotnumber   = "";
            int      quantity    = 0;
            decimal  price       = 0;
            DateTime producedate = new DateTime(1900, 1, 1);


            int.TryParse(tbx_Quantity.Text, out quantity);
            decimal.TryParse(tbx_Price.Text, out price);
            DateTime.TryParse(tbx_ProductDate.Text, out producedate);
            if (producedate.Year < 1900)
            {
                producedate = new DateTime(1900, 1, 1);
            }

            if (ddl_Unit.SelectedValue == "T")
            {
                //整件单位
                quantity = quantity * productbll.Model.ConvertFactor;
                price    = price / productbll.Model.ConvertFactor;
            }

            if (quantity == 0)
            {
                //MessageBox.Show(this, "请选择采购数量!");
                return;
            }

            lotnumber = rbl_ln.SelectedValue == "N" ? tbx_LotNumber.Text : ddl_LotNumber.SelectedValue;

            if (lotnumber == "" && producedate.Year > 1900)
            {
                lotnumber = producedate.ToString("yyyyMMdd");
            }

            if ((int)ViewState["Classify"] == 12)
            {
                #region 判断库存数量是否够退货
                int inv_quantity = INV_InventoryBLL.GetProductQuantity((int)ViewState["WareHouse"], product, lotnumber);
                if (quantity > inv_quantity)
                {
                    MessageBox.Show(this, "库存不足,不可采购退货!");
                    return;
                }
                #endregion
            }
            PBM_DeliveryDetail d = null;

            if (ViewState["SelectedDetail"] != null)
            {
                d = (PBM_DeliveryDetail)ViewState["SelectedDetail"];
            }
            else
            {
                d            = new PBM_DeliveryDetail();
                d.DeliveryID = (int)ViewState["ID"];

                if (Details.GetListItem().Count == 0)
                {
                    d.ID = 1;
                }
                else
                {
                    d.ID = Details.GetListItem().Max(p => p.ID) + 1;
                }
            }

            decimal discountrate = 100;
            decimal.TryParse(tbx_DiscountRate.Text, out discountrate);

            d.Product          = product;
            d.LotNumber        = lotnumber;
            d.ProductDate      = producedate.Year < 1900 ? new DateTime(1900, 1, 1) : producedate;
            d.CostPrice        = price;
            d.Price            = d.CostPrice;
            d.DiscountRate     = discountrate / 100; //默认100为全价
            d.ConvertFactor    = productbll.Model.ConvertFactor;
            d.DeliveryQuantity = quantity;
            d.SignInQuantity   = d.DeliveryQuantity;
            d.LostQuantity     = 0;
            d.BadQuantity      = 0;
            d.SalesMode        = int.Parse(ddl_SalesMode.SelectedValue);
            if (d.SalesMode == 2)
            {
                d.Price = 0;
            }                                           //赠送模式采购价自动设为0

            if (ViewState["SelectedDetail"] != null)
            {
                Details.Update(d);
                ViewState["SelectedDetail"] = null;
                bt_AddDetail.Text           = "新 增";
                gv_List.SelectedIndex       = -1;
            }
            else
            {
                Details.Add(d);
                //_bll.AddDetail(d);
            }
            tbx_LotNumber.Text = "";
            tbx_Quantity.Text  = "0";

            BindGrid();
        }
    }
예제 #18
0
        private void ReadListTable(Reader reader)
        {
            ListTable = new ListTable();
            while (reader.ReadToken() != null)
            {
                if (reader.TokenType == RtfTokenType.GroupEnd)
                    break;

                if (reader.TokenType == RtfTokenType.GroupStart)
                {
                    var firstRead = true;
                    RtfList currentList = null;
                    var level = reader.Level;
                    while (reader.ReadToken() != null)
                    {
                        if (reader.TokenType == RtfTokenType.GroupEnd)
                        {
                            if (reader.Level < level)
                            {
                                break;
                            }
                        }
                        else if (reader.TokenType == RtfTokenType.GroupStart)
                        {
                            // if meet nested level , then ignore
                            //reader.ReadToken();
                            //ReadToEndGround(reader);
                            //reader.ReadToken();
                        }
                        if (firstRead)
                        {
                            if (reader.CurrentToken.Key != "list")
                            {
                                // 不是以list开头,忽略掉
                                ReadToEndGround(reader);
                                reader.ReadToken();
                                break;
                            }
                            currentList = new RtfList();
                            ListTable.Add(currentList);
                            firstRead = false;
                        }

                        switch (reader.CurrentToken.Key)
                        {
                            case "listtemplateid":
                                currentList.ListTemplateId = reader.CurrentToken.Param;
                                break;

                            case "listid":
                                currentList.ListId = reader.CurrentToken.Param;
                                break;

                            case "listhybrid":
                                currentList.ListHybrid = true;
                                break;

                            case "levelfollow":
                                currentList.LevelFollow = reader.CurrentToken.Param;
                                break;

                            case "levelstartat":
                                currentList.LevelStartAt = reader.CurrentToken.Param;
                                break;

                            case "levelnfc":
                                if (currentList.LevelNfc == RtfLevelNumberType.None)
                                    currentList.LevelNfc = (RtfLevelNumberType) reader.CurrentToken.Param;
                                break;

                            case "levelnfcn":
                                if (currentList.LevelNfc == RtfLevelNumberType.None)
                                    currentList.LevelNfc = (RtfLevelNumberType) reader.CurrentToken.Param;
                                break;

                            case "leveljc":
                                currentList.LevelJc = reader.CurrentToken.Param;
                                break;

                            case "leveltext":
                                if (string.IsNullOrEmpty(currentList.LevelText))
                                {
                                    var text = ReadInnerText(reader, true);
                                    if (text != null && text.Length > 2)
                                    {
                                        int len = text[0];
                                        len = Math.Min(len, text.Length - 1);
                                        text = text.Substring(1, len);
                                    }
                                    currentList.LevelText = text;
                                }
                                break;

                            case "f":
                                currentList.FontName = FontTable.GetFontName(reader.CurrentToken.Param);
                                break;
                        }
                    }
                }
            } 
        }
예제 #19
0
    protected void bt_AddProduct_Click(object sender, EventArgs e)
    {
        #region 验证必填项
        if (ViewState["Product"] == null || (int)ViewState["Product"] == 0)
        {
            lb_ProductName.Text      = "产品必填!";
            lb_ProductName.ForeColor = System.Drawing.Color.Red;
            return;
        }
        #endregion

        ListTable <PDT_ProductCost> _details = (ListTable <PDT_ProductCost>)ViewState["Details"];

        PDT_ProductCost item;
        #region 产品存在与否判断
        if (ViewState["Selected"] == null)
        {
            //新增产品
            if (_details.Contains(ViewState["Product"].ToString()))
            {
                lb_ProductName.Text = "该产品已添加!";
                return;
            }

            item              = new PDT_ProductCost();
            item.Product      = (int)ViewState["Product"];
            item.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
        }
        else
        {
            //修改科目
            if (!_details.Contains(ViewState["Product"].ToString()))
            {
                lb_ProductName.Text = "要修改的产品不存在!";
                return;
            }
            item = _details[ViewState["Selected"].ToString()];

            select_ProductCode.Enabled = true;
            gv_List.SelectedIndex      = -1;
        }
        #endregion

        item["CostPrice"]      = tbx_CostPrice.Text == "" ? "0" : tbx_CostPrice.Text;
        item["CostPrice2"]     = tbx_CostPrice2.Text == "" ? "0" : tbx_CostPrice2.Text;
        item["CostPrice3"]     = tbx_CostPrice3.Text == "" ? "0" : tbx_CostPrice3.Text;
        item["QuantityFactor"] = tbx_QuantityFactor.Text;


        if (ViewState["Selected"] == null)
        {
            _details.Add(item);             //新增产品
        }
        else
        {
            _details.Update(item);          //更新产品
        }
        BindGrid();

        lb_ProductName.ForeColor      = System.Drawing.Color.Black;
        select_ProductCode.SelectText = "";
        tbx_CostPrice.Text            = "0";
        tbx_CostPrice2.Text           = "0";
        tbx_CostPrice3.Text           = "0";
        tbx_QuantityFactor.Text       = "1";
        ViewState["Selected"]         = null;
        bt_AddProduct.Text            = "增加";
    }
    //新增
    protected void bt_Add_Click(object sender, EventArgs e)
    {
        ListTable <EWF_Flow_DataObject> lt = (ListTable <EWF_Flow_DataObject>)ViewState["ListTable"];

        if (ViewState["SelectedName"] == null)
        {
            if (!lt.Contains(tbx_Name.Text))
            {
                #region 新增数据字段
                EWF_Flow_DataObject item = new EWF_Flow_DataObject();
                item["App"]               = ViewState["AppID"].ToString();
                item["Name"]              = tbx_Name.Text;
                item["DisplayName"]       = tbx_DisplayName.Text;
                item["DataType"]          = ddl_DataType.SelectedValue;
                item["ReadOnly"]          = rbl_ReadOnly.SelectedValue;
                item["Enable"]            = rbl_Enable.SelectedValue;
                item["Visible"]           = rbl_Visible.SelectedValue;
                item["ControlType"]       = ddl_ControlType.SelectedValue;
                item["ControlWidth"]      = tbx_ControlWidth.Text;
                item["ControlHeight"]     = tbx_ControlHeight.Text;
                item["ControlStyle"]      = tbx_ControlStyle.Text;
                item["ColSpan"]           = tbx_ColSpan.Text;
                item["SortID"]            = tbx_SortID.Text;
                item["IsRequireField"]    = rbl_IsRequireField.SelectedValue;
                item["RegularExpression"] = tbx_RegularExpression.Text;
                item["FormatString"]      = tbx_FormatString.Text;
                item["Description"]       = tbx_Description.Text;
                item["RelationType"]      = rbl_RelationType.SelectedValue;

                if (item["RelationType"] != "3")
                {
                    item["RelationTableName"] = ddl_RelationTableName.SelectedValue;
                    if (item["RelationType"] == "2")
                    {
                        item["RelationValueField"] = ddl_RelationValueField.SelectedValue;
                        item["RelationTextField"]  = ddl_RelationTextField.SelectedValue;
                    }
                }
                item["SearchPageURL"] = tbx_SearchPageURL.Text;
                lt.Add(item);
                #endregion
            }
        }
        else
        {
            if (lt.Contains((string)ViewState["SelectedName"]))
            {
                #region 修改数据字段
                EWF_Flow_DataObject item = lt[(string)ViewState["SelectedName"]];

                item["App"]               = ViewState["AppID"].ToString();
                item["Name"]              = tbx_Name.Text;
                item["DisplayName"]       = tbx_DisplayName.Text;
                item["DataType"]          = ddl_DataType.SelectedValue;
                item["ReadOnly"]          = rbl_ReadOnly.SelectedValue;
                item["Enable"]            = rbl_Enable.SelectedValue;
                item["Visible"]           = rbl_Visible.SelectedValue;
                item["ControlType"]       = ddl_ControlType.SelectedValue;
                item["ControlWidth"]      = tbx_ControlWidth.Text;
                item["ControlHeight"]     = tbx_ControlHeight.Text;
                item["ControlStyle"]      = tbx_ControlStyle.Text;
                item["ColSpan"]           = tbx_ColSpan.Text;
                item["SortID"]            = tbx_SortID.Text;
                item["IsRequireField"]    = rbl_IsRequireField.SelectedValue;
                item["RegularExpression"] = tbx_RegularExpression.Text;
                item["FormatString"]      = tbx_FormatString.Text;
                item["Description"]       = tbx_Description.Text;
                item["RelationType"]      = rbl_RelationType.SelectedValue;
                if (item["RelationType"] != "3")
                {
                    item["RelationTableName"] = ddl_RelationTableName.SelectedValue;
                    if (item["RelationType"] == "2")
                    {
                        item["RelationValueField"] = ddl_RelationValueField.SelectedValue;
                        item["RelationTextField"]  = ddl_RelationTextField.SelectedValue;
                    }
                }
                item["SearchPageURL"] = tbx_SearchPageURL.Text;
                lt.Update(item);
                #endregion
            }

            ViewState["SelectedName"] = null;
        }

        bt_Add.Text           = "新 增";
        gv_List.SelectedIndex = -1;

        tbx_DisplayName.Text = "";
        tbx_Name.Text        = "";
        tbx_SortID.Text      = (int.Parse(tbx_SortID.Text) + 1).ToString();
        BindGrid();
    }
예제 #21
0
    protected void bt_AddDetail_Click(object sender, EventArgs e)
    {
        if ((int)ViewState["ID"] == 0)
        {
            return;
        }
        PBM_DeliveryBLL _bll = new PBM_DeliveryBLL((int)ViewState["ID"]);

        if (ViewState["Details"] == null)
        {
            return;
        }
        ListTable <PBM_DeliveryDetail> Details = (ListTable <PBM_DeliveryDetail>)ViewState["Details"];

        int product = 0;

        int.TryParse(select_Product.SelectValue, out product);
        //int.TryParse(RadComboBox1.SelectedValue, out product);
        if (product != 0)
        {
            PDT_ProductBLL productbll = new PDT_ProductBLL(product, true);
            if (productbll.Model == null)
            {
                return;
            }
            if (productbll.Model.ConvertFactor == 0)
            {
                productbll.Model.ConvertFactor = 1;
                productbll.Update();
            }

            int     quantity = 0;
            decimal price    = 0;

            int.TryParse(tbx_Quantity.Text, out quantity);
            decimal.TryParse(tbx_Price.Text, out price);

            if (ddl_Unit.SelectedValue == "T")
            {
                //整件单位
                quantity = quantity * productbll.Model.ConvertFactor;
                price    = price / productbll.Model.ConvertFactor;
            }

            if (quantity == 0)
            {
                MessageBox.Show(this, "请填写数量!");
                return;
            }

            if ((int)ViewState["Classify"] != 2)
            {
                #region 销售时判断库存数量是否够退货
                int inv_quantity = INV_InventoryBLL.GetProductQuantity((int)ViewState["WareHouse"], product, ddl_LotNumber.SelectedValue);
                if (quantity > inv_quantity)
                {
                    MessageBox.Show(this, "库存不足,不可销售出库!");
                    return;
                }
                #endregion
            }

            INV_Inventory inv = INV_InventoryBLL.GetInventoryByProductAndLotNumber((int)ViewState["WareHouse"],
                                                                                   product, ddl_LotNumber.SelectedValue);
            if (inv == null)
            {
                MessageBox.Show(this, "请正确选择销售批号!");
                return;
            }

            PBM_DeliveryDetail d = null;

            if (ViewState["SelectedDetail"] != null)
            {
                d = (PBM_DeliveryDetail)ViewState["SelectedDetail"];
            }
            else
            {
                d            = new PBM_DeliveryDetail();
                d.DeliveryID = (int)ViewState["ID"];

                if (Details.GetListItem().Count == 0)
                {
                    d.ID = 1;
                }
                else
                {
                    d.ID = Details.GetListItem().Max(p => p.ID) + 1;
                }
            }

            d.Product          = product;
            d.LotNumber        = ddl_LotNumber.SelectedValue;
            d.CostPrice        = inv.Price;     //成本价取当前库存表的价格
            d.Price            = price;         //实际销售价
            d.ConvertFactor    = productbll.Model.ConvertFactor;
            d.DiscountRate     = 1;             //默认全价
            d.DeliveryQuantity = quantity;
            d.SignInQuantity   = d.DeliveryQuantity;
            d.LostQuantity     = 0;
            d.BadQuantity      = 0;
            d.SalesMode        = 1;
            if (d.SalesMode == 2)
            {
                d.Price = 0;
            }

            if (ViewState["SelectedDetail"] != null)
            {
                Details.Update(d);
                //_bll.UpdateDetail(d);
                ViewState["SelectedDetail"] = null;
                bt_AddDetail.Text           = "新 增";
                gv_List.SelectedIndex       = -1;
            }
            else
            {
                Details.Add(d);
                //_bll.AddDetail(d);
            }

            tbx_Quantity.Text = "0";

            BindGrid();
        }
    }
예제 #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region 判断传入参数是否为SheetCode
            if (Request.QueryString["SheetCode"] != null)
            {
                string code = Request.QueryString["SheetCode"];

                IList <ORD_OrderApply> list = ORD_OrderApplyBLL.GetModelList("SheetCode='" + code + "'");
                if (list.Count > 0)
                {
                    Response.Redirect("OrderProductApplyDetail.aspx?ID=" + list[0].ID.ToString());
                }
                else
                {
                    Response.Redirect("OrderApplyList.aspx");
                }
            }
            #endregion
            ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);

            BindDropDown();
            ViewState["Product"] = 0;

            #region 创建空的列表
            ListTable <ORD_OrderApplyDetail> _details = new ListTable <ORD_OrderApplyDetail>(new ORD_OrderApplyBLL((int)ViewState["ID"]).Items, "Product");
            ViewState["Details"] = _details;
            #endregion

            if (Session["LogisticsOrderApplyDetail"] != null && (int)ViewState["ID"] == 0)
            {
                #region 新费用申请时,初始化申请信
                ORD_OrderCartBLL cart  = (ORD_OrderCartBLL)Session["LogisticsOrderApplyDetail"];
                ORD_OrderApply   model = new ORD_OrderApply();
                if (cart.Client != 0)
                {
                    model.OrganizeCity = new CM_ClientBLL(cart.Client).Model.OrganizeCity;
                    model.Client       = cart.Client;
                }
                model.InsertStaff     = (int)Session["UserID"];
                model.InsertTime      = DateTime.Now;
                model["IsSpecial"]    = cart.IsSpecial.ToString();
                model.Type            = cart.Type;
                ViewState["Type"]     = cart.Type;
                model["ProductBrand"] = cart.Brand.ToString();
                model["ProductType"]  = cart.OrderType.ToString();
                if (cart.OrderType != 1)
                {
                    priceEnable = true;
                }
                model.AccountMonth = AC_AccountMonthBLL.GetCurrentMonth();

                ORD_OrderLimitFactorBLL limitbll = new ORD_OrderLimitFactorBLL();
                ViewState["Limit"] = limitbll.GetLimitInfo(Convert.ToInt32(model.AccountMonth), cart.Client);
                bt_Submit.Visible  = false;


                foreach (ORD_OrderCart item in cart.Items)
                {
                    ORD_OrderApplyDetail _detailmodel = new ORD_OrderApplyDetail();
                    _detailmodel.Price        = item.Price;
                    _detailmodel.Product      = item.Product;
                    _detailmodel.BookQuantity = item.BookQuantity;
                    _details.Add(_detailmodel);
                }
                ViewState["Details"] = _details;
                pn_OrderApply.BindData(model);
                BindGrid();
                #endregion
            }
            else
            {
                BindData();
            }

            Header.Attributes["WebPageSubCode"] = "Type=" + ViewState["Type"].ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);
            ViewState["Client"] = Request.QueryString["Client"] == null ? 0 : int.Parse(Request.QueryString["Client"]);
            BindDropDown();

            pn_OrderDelivery.SetPanelVisible("Panel_LGS_OrderDeliveryDetail00_02", false);

            if ((int)ViewState["ID"] == 0)
            {
                if ((int)ViewState["Client"] == 0) return;

                #region 新增发货单时,初始化界面
                CM_Client client = new CM_ClientBLL((int)ViewState["Client"]).Model;
                if (client != null)
                {
                    ViewState["OrganizeCity"] = client.OrganizeCity;
                    Label lb_Client = (Label)pn_OrderDelivery.FindControl("ORD_OrderDelivery_Client");
                    if (lb_Client != null) lb_Client.Text = client.FullName;

                    MCSSelectControl select_Store = (MCSSelectControl)pn_OrderDelivery.FindControl("ORD_OrderDelivery_Store");
                    if (select_Store != null && client.Supplier != 0)
                    {
                        select_Store.SelectText = new CM_ClientBLL(client.Supplier).Model.FullName;
                        select_Store.SelectValue = client.Supplier.ToString();
                    }

                    TextBox tbx_DeliveryTime = (TextBox)pn_OrderDelivery.FindControl("ORD_OrderDelivery_DeliveryTime");
                    if (tbx_DeliveryTime != null) tbx_DeliveryTime.Text = DateTime.Today.ToString("yyyy-MM-dd");

                    TextBox tbx_PreArrivalDate = (TextBox)pn_OrderDelivery.FindControl("ORD_OrderDelivery_PreArrivalDate");
                    if (tbx_PreArrivalDate != null) tbx_PreArrivalDate.Text = DateTime.Today.AddDays(1).ToString("yyyy-MM-dd");

                    bNoDelivery = true;
                    bt_Delete.Visible = false;

                }
                #endregion

                #region 创建空的列表
                ListTable<ORD_OrderDeliveryDetail> _details = new ListTable<ORD_OrderDeliveryDetail>
                    (new List<ORD_OrderDeliveryDetail>(), "Product");
                DataTable dtProduct = ORD_OrderDeliveryBLL.InitProductList((int)ViewState["Client"], 0);
                foreach (DataRow row in dtProduct.Rows)
                {
                    ORD_OrderDeliveryDetail item = new ORD_OrderDeliveryDetail();
                    item.Product = (int)row["Product"];
                    item.FactoryPrice = (decimal)row["FactoryPrice"];
                    item.Price = (decimal)row["SalesPrice"];
                    item.Client = (int)ViewState["Client"];
                    item.DeliveryQuantity = 0;
                    item.SignInQuantity = 0;
                    item.BadQuantity = 0;
                    item.LostQuantity = 0;

                    _details.Add(item);
                }

                ViewState["Details"] = _details;
                #endregion

                BindGrid();
            }
            else
            {
                BindData();
            }

        }
    }
예제 #24
0
    protected void bt_Add_Click(object sender, EventArgs e)
    {
        #region 验证必填项
        decimal costPrice = 0;
        if (ddl_Brand.SelectedValue == "0" || ddl_Brand.SelectedValue == "")
        {
            MessageBox.Show(this, "产品品牌必选!");
            return;
        }
        else if (ddl_GiftCostClassify.SelectedValue == "0" || ddl_GiftCostClassify.SelectedValue == "")
        {
            MessageBox.Show(this, "赠品费用类别必选!");
            return;
        }
        else if (!decimal.TryParse(tbx_CostPrice.Text, out costPrice))
        {
            MessageBox.Show(this, "赠品费率必须是小数或整数!");
            return;
        }
        #endregion

        ListTable <PDT_ClassifyGiftCostRate> _details = (ListTable <PDT_ClassifyGiftCostRate>)ViewState["Details"];

        PDT_ClassifyGiftCostRate item;
        #region 产品存在与否判断
        if (ViewState["Selected"] == null)
        {
            item = new PDT_ClassifyGiftCostRate();
            if (select_Client.SelectValue == "" || select_Client.SelectValue == "0")
            {
                item.OrganizeCity = int.Parse(tr_OrganizeCity.SelectValue);
            }
            else
            {
                item.Client       = int.Parse(select_Client.SelectValue.ToString());
                item.OrganizeCity = new CM_ClientBLL(item.Client).Model.OrganizeCity;
            }
            item["InsertStaff"] = Session["UserID"].ToString();
            ViewState["MAXID"]  = ((int)ViewState["MAXID"]) + 1;
            item.ID             = (int)ViewState["MAXID"];
        }
        else
        {
            //修改科目
            if (!_details.Contains(ViewState["Selected"].ToString()))
            {
                MessageBox.Show(this, "要修改的产品不存在!");
                return;
            }
            item = _details[ViewState["Selected"].ToString()];
            item["UpdateStaff"]   = Session["UserID"].ToString();
            gv_List.SelectedIndex = -1;
        }
        #endregion

        item["PDTBrand"] = ddl_Brand.SelectedValue;

        item["GiftCostClassify"] = ddl_GiftCostClassify.SelectedValue;
        item["Enabled"]          = ddl_Enabled.SelectedValue;

        item["GiftCostRate"] = tbx_CostPrice.Text;
        item["UpdateStaff"]  = Session["UserID"].ToString();
        item.BeginMonth      = int.Parse(ddl_BeginMonth.SelectedValue);
        int cycle = 0;
        if (int.TryParse(txt_Cycle.Text.Trim(), out cycle))
        {
            item.Cycle = cycle;
        }
        item.Remark = tbx_Remark.Text.Trim();

        if (ViewState["Selected"] == null)
        {
            foreach (PDT_ClassifyGiftCostRate p in _details.GetListItem())
            {
                if (p.PDTBrand == item.PDTBrand && p.GiftCostClassify == item.GiftCostClassify)
                {
                    MessageBox.Show(this, "已存在该分类的数据!");
                    return;
                }
            }

            _details.Add(item);
        }
        else
        {
            _details.Update(item);          //更新产品
        }


        BindGrid();
        ddl_Brand.SelectedValue            = "0";
        ddl_GiftCostClassify.SelectedValue = "0";
        ddl_Brand.Enabled            = true;
        ddl_GiftCostClassify.Enabled = true;
        tbx_CostPrice.Text           = "";
        tbx_Remark.Text       = "";
        ViewState["Selected"] = null;
        bt_Add.Text           = "增加";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region 判断传入参数是否为SheetCode
            if (Request.QueryString["SheetCode"] != null)
            {
                string code = Request.QueryString["SheetCode"];

                IList<ORD_OrderApply> list = ORD_OrderApplyBLL.GetModelList("SheetCode='" + code + "'");
                if (list.Count > 0)
                {
                    Response.Redirect("OrderProductApplyDetail.aspx?ID=" + list[0].ID.ToString());
                }
                else
                    Response.Redirect("OrderApplyList.aspx");
            }
            #endregion
            ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]);

            BindDropDown();
            ViewState["Product"] = 0;

            #region 创建空的列表
            ListTable<ORD_OrderApplyDetail> _details = new ListTable<ORD_OrderApplyDetail>(new ORD_OrderApplyBLL((int)ViewState["ID"]).Items, "Product");
            ViewState["Details"] = _details;
            #endregion

            if (Session["LogisticsOrderApplyDetail"] != null && (int)ViewState["ID"] == 0)
            {
                #region 新费用申请时,初始化申请信
                ORD_OrderCartBLL cart = (ORD_OrderCartBLL)Session["LogisticsOrderApplyDetail"];
                ORD_OrderApply model = new ORD_OrderApply();
                if (cart.Client != 0)
                {
                    model.OrganizeCity = new CM_ClientBLL(cart.Client).Model.OrganizeCity;
                    model.Client = cart.Client;
                }
                model.InsertStaff = (int)Session["UserID"];
                model.InsertTime = DateTime.Now;
                model["IsSpecial"] = cart.IsSpecial.ToString();
                model.Type = cart.Type;
                ViewState["Type"] = cart.Type;
                model["ProductBrand"] = cart.Brand.ToString();
                model["ProductType"] = cart.OrderType.ToString();
                if (cart.OrderType != 1) priceEnable = true;
                model.AccountMonth = AC_AccountMonthBLL.GetCurrentMonth();

                ORD_OrderLimitFactorBLL limitbll = new ORD_OrderLimitFactorBLL();
                ViewState["Limit"] = limitbll.GetLimitInfo(Convert.ToInt32(model.AccountMonth), cart.Client);
                bt_Submit.Visible = false;

                foreach (ORD_OrderCart item in cart.Items)
                {
                    ORD_OrderApplyDetail _detailmodel = new ORD_OrderApplyDetail();
                    _detailmodel.Price = item.Price;
                    _detailmodel.Product = item.Product;
                    _detailmodel.BookQuantity = item.BookQuantity;
                    _details.Add(_detailmodel);
                }
                ViewState["Details"] = _details;
                pn_OrderApply.BindData(model);
                BindGrid();
                #endregion
            }
            else
            {
                BindData();
            }

            Header.Attributes["WebPageSubCode"] = "Type=" + ViewState["Type"].ToString();

        }
    }
예제 #26
0
파일: MainForm.cs 프로젝트: ljhbeer/backup
        public Cmd(string str)
        {
            string[] items = str.Split(new string[] { ";\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            cmdkeyvalue = new Dictionary <string, string>();
            foreach (string s in items)
            {
                if (s.Contains("="))
                {
                    string name = s.Substring(0, s.IndexOf('=')).Trim();
                    if (ValidTools.ValidName(name) && !cmdkeyvalue.ContainsKey(name))
                    {
                        cmdkeyvalue[name] = s.Substring(s.IndexOf('=') + 1);
                    }
                }
            }

            if (cmdkeyvalue.ContainsKey("replacetonull"))
            {
                ReplacetoNullTags = new BETags(cmdkeyvalue["replacetonull"]);
            }
            if (cmdkeyvalue.ContainsKey("addprefix"))
            {
                Prefix = cmdkeyvalue["addprefix"];
            }
            if (cmdkeyvalue.ContainsKey("addsubfix"))
            {
                Subfix = cmdkeyvalue["addsubfix"];
            }

            return;

            ///////////////////////////////
            if (cmdkeyvalue.ContainsKey("nexturl"))
            {
                NextUrlTags = new BETags(cmdkeyvalue["nexturl"]);
            }
            if (cmdkeyvalue.ContainsKey("nextexist"))
            {
                NextExist = cmdkeyvalue["nextexist"];
            }
            if (cmdkeyvalue.ContainsKey("replacetemplate"))
            {
                ReplaceTemplate = cmdkeyvalue["replacetemplate"];
                ReplaceTemplate = ReplaceTemplate.Replace("\\r\\n", "\r\n")
                                  .Replace("\\t", "\t");
            }
            if (cmdkeyvalue.ContainsKey("multisubitem"))
            {
                MultiSubItemTags = new BETags(cmdkeyvalue["multisubitem"]);
            }
            if (cmdkeyvalue.ContainsKey("reversematch"))
            {
                if (cmdkeyvalue["reversematch"] == "true")
                {
                    ReverseMatch = true;
                }
            }
            if (cmdkeyvalue.ContainsKey("txtasurl"))
            {
                if (cmdkeyvalue["txtasurl"] == "true")
                {
                    TxtAsUrl = true;
                }
            }
            if (cmdkeyvalue.ContainsKey("dbidbeginend"))
            {
                BETags bts = new BETags(cmdkeyvalue["dbidbeginend"]);
                Bedbid = null;
                if (bts.tags.Count == 1 && ValidTools.ValidNumber(bts.tags[0].Begin) &&
                    ValidTools.ValidNumber(bts.tags[0].End))
                {
                    Bedbid   = new BEId();
                    Bedbid.B = Convert.ToInt32(bts.tags[0].Begin);
                    Bedbid.E = int.MaxValue;
                    if (ValidTools.ValidNumber(bts.tags[0].End))
                    {
                        Bedbid.E = Convert.ToInt32(bts.tags[0].End);
                    }
                    Bedbid.MoveToTop();
                }//else 未设置BeDbid
            }
            if (cmdkeyvalue.ContainsKey("savepath"))
            {
                SavePath = cmdkeyvalue["savepath"];
            }
            if (cmdkeyvalue.ContainsKey("downloadsuburl"))
            {
                string downloadsuburl = cmdkeyvalue["downloadsuburl"];
                if (downloadsuburl.ToLower().Trim() == "true")
                {
                    DownLoadSuburl     = true;
                    DownLoadSuburlType = "auto";
                    if (cmdkeyvalue.ContainsKey("downloadsuburltype"))
                    {
                        DownLoadSuburlType = cmdkeyvalue["downloadsuburltype"].Trim();
                    }
                }
            }
            if (cmdkeyvalue.ContainsKey("casecmd"))
            {
                BEPos bp = BETag.FormatCmd(cmdkeyvalue["casecmd"], '{', '}');
                if (bp.Valid())
                {
                    string cmdstr = bp.String;
                    caseCmd = new CaseCmd(cmdstr);
                }
            }
            if (cmdkeyvalue.ContainsKey("table"))
            {
                BEPos bp = BETag.FormatCmd(cmdkeyvalue["table"], '{', '}');
                if (bp.Valid())
                {
                    string tablecmdstr = bp.String;
                    tableCmd = new TableCmd(tablecmdstr);
                    ListTable.Add(tableCmd); // 以后可以添加多个Table
                }
            }
            if (cmdkeyvalue.ContainsKey("tablevalue"))
            {
                BEPos bp = BETag.FormatCmd(cmdkeyvalue["tablevalue"], '{', '}');
                if (bp.Valid())
                {
                    string tablecmdstr = bp.String;
                    tablevalueCmd = new TableValueCmd(tablecmdstr);
                }
            }
        }