예제 #1
0
        public void Save(T_SHMXModels model)
        {
            int    result = 0;
            string guid   = string.Empty;

            try
            {
                if (model.Tag == "Add")
                {
                    model.DataModel.GUID = Guid.NewGuid().ToString("N");
                    guid   = model.DataModel.GUID;
                    result = T_SHMXDomain.GetInstance().AddModelByCkdh(model.DataModel, model.SHDH);
                }
                else if (model.Tag == "Edit")
                {
                    result = T_SHMXDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.SHMXID);
                }
            }
            catch { }
            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_SHD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
예제 #2
0
        public void Delete(string guid)
        {
            int result = T_SHMXDomain.GetInstance().DeleteModelByGuid(guid);

            Response.ContentType = "text/json";
            if (result > 0)
            {
                Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_SHD/Index\"}");
            }
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
예제 #3
0
        private string ExportExcelPRNew(System.Int32 id)
        {
            //获取需要打印的数据
            var ckdinfo = T_SHDDomain.GetInstance().GetModelById(id);

            List <T_SHMX> ckmxList = T_SHMXDomain.GetInstance().GetListModelById(id);
            T_WhsQY       qy       = new T_WhsQY();

            Expression <Func <T_WhsQY, bool> > where = PredicateBuilder.True <T_WhsQY>();
            var lst = T_WhsQYDomain.GetInstance().GetAllModels <int>(where);

            if (lst != null && lst.Count > 0)
            {
                qy = lst[0];
            }
            //命名导出表格的StringBuilder变量
            StringBuilder sHtml = new StringBuilder(string.Empty);

            //打印表头
            sHtml.Append("<table style='border-collapse:collapse;'>");
            sHtml.Append("<tr height=\"40\"><td colspan=\"12\" align=\"center\" style='font-size:24px;border:0px;'><b>" + qy.WhsMC + "损耗单" + "</b></td></tr>");
            sHtml.Append("<tr height=\"40\"><td align=\"left\"  colspan=\"8\" style='border:0px;'>日 期:" + DateTime.Now.ToString("yyyy-MM-dd") + "</td><td align=\"right\"  colspan=\"4\"  style='border:0px;'>单据编号:" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + "</td></tr>");
            //sHtml.Append("</table>");
            //sHtml.Append("<table border=\"1\" width=\"100%\" style='border-collapse:collapse;border:1px solid black;'>");
            sHtml.Append("<tr align=\"center\" ><td style='width: 80px;'>产品名称</td><td style='width: 40px;'>规格</td><td style='width: 40px;'>型号</td><td style='width: 100px;'>生产企业</td><td style='width: 70px;'>生产日期</td><td style='width: 35px;'>单位</td><td style='width: 35px;'>数量</td><td style='width: 40px;'>单价</td>"
                         + "<td style='width: 60px;'>金额</td><td style='width: 70px;'>产品批号</td><td style='width: 80px;'>产品有效期</td><td style='width: 80px;'>经营许可证号</td><td style='width: 70px;'>注册证号</td></tr>");

            //合计
            double total    = 0.0;
            double NumCpNum = 0.0;

            for (int i = 0; i < ckmxList.Count; i++)
            {
                var ckmx = ckmxList[i];
                //产品名称
                string cpName = ckmx.T_YLCP.CPMC;
                //规格
                string cpGg = ckmx.T_YLCP.CPGG ?? "";

                var cpxh = ckmx.T_YLCP.CPXH ?? "";
                //单位
                string cpDw = ckmx.T_YLCP.CPDW ?? "";
                //数量
                double cpDj = ckmx.CPNUM ?? 0;
                //产品批号
                string scPh = ckmx.CPPH ?? "";
                //产品有效期
                string scRq = "";
                if (ckmx.CPYXQ != null)
                {
                    scRq = ckmx.CPYXQ.Value.ToString("yyyyMMdd");
                }
                var scrq = "";
                if (ckmx.CPSCRQ != null)
                {
                    scrq = ckmx.CPSCRQ.Value.ToString("yyyyMMdd");
                }
                //生产企业
                string cpScqy = "";
                if (ckmx.T_YLCP != null && ckmx.T_YLCP.T_SupQY1 != null && !string.IsNullOrEmpty(ckmx.T_YLCP.T_SupQY1.SupMC))
                {
                    cpScqy = ckmx.T_YLCP.T_SupQY1.SupMC;
                }
                //单价
                double cpPrice = Math.Round(ckmx.T_YLCP.CPPrice ?? 0.0, 2);
                //产品总价
                double rowTotal = Math.Round(cpDj * cpPrice, 2);

                total    = total + rowTotal;
                NumCpNum = NumCpNum + cpDj;
                //经营许可证号
                string xkzbh = "";
                if (ckmx.T_YLCP != null && ckmx.T_YLCP.T_SupQY1 != null && !string.IsNullOrEmpty(ckmx.T_YLCP.T_SupQY1.SupXKZBH))
                {
                    xkzbh = ckmx.T_YLCP.T_SupQY1.SupXKZBH;
                }
                //注册证号
                string cpzczh = ckmx.T_YLCP.CPZCZ;
                sHtml.Append("<tr align=\"center\"><td>" + cpName
                             + "</td><td>" + cpGg + "</td><td>" + cpxh + "</td><td>" + cpScqy
                             + "</td><td>" + scrq
                             + "</td><td>" + cpDw + "</td><td>" + cpDj.ToString()
                             + "</td><td>" + cpPrice.ToString("0.00") + "</td><td>" + rowTotal.ToString("0.00") + "</td><td>" + scPh + "</td><td>" + scRq
                             + "</td><td>" + xkzbh
                             + "</td><td>" + cpzczh
                             + "</td></tr>");
            }
            //打印表尾
            sHtml.Append("<tr id='trtotal' height=\"40\" align=\"center\"><td colspan=\"9\">合计金额:(大写)" + MoneySmallToBig(total.ToString()) + "</td><td colspan=\"4\">(小写)" + total.ToString("0.00") + "</td></tr>");
            //sHtml.Append("</table>");
            //sHtml.Append("<table  border=\"0\" width=\"100%\">");
            sHtml.Append("<tr height=\"40\" align=\"center\"><td colspan=\"7\" align=\"left\" style='border:0px;'>申请人:&nbsp;" + ckdinfo.SQR + "</td><td align=\"left\" colspan='5' style='border:0px;'>复核员:&nbsp;" + ckdinfo.FHY + "</td></tr>");
            sHtml.Append("</table>");
            return(sHtml.ToString());
        }