需求描述:
此购进单的基本信息,购进单位,入库单位,入库时间……
此购进单批号,产品名称,生产企业,等基本信息。
实现能够循环加载打印。
本单金额小计,整单金额合计计算。
技术需求:
界面设计,循环加载数据
实现函数:根据产品编号查询产品生产企业
实现函数:根据产品查询产品规格
实现函数:根据产品查询产品单位
实现金额数字转换大写

金额大小写转换的类:

namespace CommTool
{
/// <summary>
/// 字符串处理相关 /// </summary>
public class StringHandler
{
/// <summary>
/// author:sunliyuan
/// sunliyuan:2011年12月4日
/// 转换人民币大小金额
/// </summary>
/// <param name="num">金额</param>
/// <returns>返回大写形式</returns>
public static string CmycurD(decimal num)
{
string str1 = "零壹贰叁肆伍陆柒捌玖"; //0-9所对应的汉字
string str2 = "万仟佰拾亿仟佰拾万仟佰拾元角分"; //数字位所对应的汉字
string str3 = ""; //从原num值中取出的值
string str4 = ""; //数字的字符串形式
string str5 = ""; //人民币大写金额形式
int i; //循环变量
int j; //num的值乘以100的字符串长度
string ch1 = ""; //数字的汉语读法
string ch2 = ""; //数字位的汉字读法
int nzero = 0; //用来计算连续的零值是几个
int temp; //从原num值中取出的值 num = Math.Round(Math.Abs(num), 2); //将num取绝对值并四舍五入取2位小数
str4 = ((long)(num * 100)).ToString(); //将num乘100并转换成字符串形式
j = str4.Length; //找出最高位
if (j > 15) { return "溢出"; }
str2 = str2.Substring(15 - j); //取出对应位数的str2的值。如:200.55,j为5所以str2=佰拾元角分 //循环取出每一位需要转换的值
for (i = 0; i < j; i++)
{
str3 = str4.Substring(i, 1); //取出需转换的某一位的值
temp = Convert.ToInt32(str3); //转换为数字
if (i != (j - 3) && i != (j - 7) && i != (j - 11) && i != (j - 15))
{
//当所取位数不为元、万、亿、万亿上的数字时
if (str3 == "0")
{
ch1 = "";
ch2 = "";
nzero = nzero + 1;
}
else
{
if (str3 != "0" && nzero != 0)
{
ch1 = "零" + str1.Substring(temp * 1, 1);
ch2 = str2.Substring(i, 1);
nzero = 0;
}
else
{
ch1 = str1.Substring(temp * 1, 1);
ch2 = str2.Substring(i, 1);
nzero = 0;
}
}
}
else
{
//该位是万亿,亿,万,元位等关键位
if (str3 != "0" && nzero != 0)
{
ch1 = "零" + str1.Substring(temp * 1, 1);
ch2 = str2.Substring(i, 1);
nzero = 0;
}
else
{
if (str3 != "0" && nzero == 0)
{
ch1 = str1.Substring(temp * 1, 1);
ch2 = str2.Substring(i, 1);
nzero = 0;
}
else
{
if (str3 == "0" && nzero >= 3)
{
ch1 = "";
ch2 = "";
nzero = nzero + 1;
}
else
{
if (j >= 11)
{
ch1 = "";
nzero = nzero + 1;
}
else
{
ch1 = "";
ch2 = str2.Substring(i, 1);
nzero = nzero + 1;
}
}
}
}
}
if (i == (j - 11) || i == (j - 3))
{
//如果该位是亿位或元位,则必须写上
ch2 = str2.Substring(i, 1);
}
str5 = str5 + ch1 + ch2; if (i == j - 1 && str3 == "0")
{
//最后一位(分)为0时,加上“整”
str5 = str5 + '整';
}
}
if (num == 0)
{
str5 = "零元整";
}
return str5;
} /// <summary>
/// author:sunliyuan
/// 2011年12月4日
/// 转换人民币大小金额 (一个重载,将字符串先转换成数字在调用CmycurD)
/// </summary>
/// <param name="num">用户输入的金额,字符串形式未转成decimal</param>
/// <returns></returns>
public static string CmycurD(string numstr)
{
try
{
decimal num = Convert.ToDecimal(numstr);
return CmycurD(num);
}
catch
{
return "非数字形式!";
}
} } }

根据产品编号查询产品的生产企业

-- Description:	根据产品编号查询产品的生产企业
-- =============================================
CREATE FUNCTION [dbo].[FN_getMadeEnterpriseByProID]
(
@ProID INT
)
RETURNS NVARCHAR(100)
AS
BEGIN
DECLARE @MadeEnterprise NVARCHAR(100)
SELECT @MadeEnterprise=MadeEnterprise FROM dbo.BiotbProduct
WHERE ProID=@ProID
RETURN @MadeEnterprise
END

根据产品编号查询产品规格:

-- Description:	根据产品编号查询产品规格
-- =============================================
CREATE FUNCTION [dbo].[FN_getProSpecbyProID]
(
@ProID INT
)
RETURNS NVARCHAR(100)
AS
BEGIN
-- Declare the return variable here
DECLARE @Spec NVARCHAR(100) -- Add the T-SQL statements to compute the return value here
SELECT @Spec=spec FROM BiotbProduct WHERE ProID=@ProID -- Return the result of the function
RETURN @Spec
END

根据产品编号查询产品单位:

-- Description:	根据产品编号查询产品单位
-- =============================================
CREATE FUNCTION [dbo].[FN_getProUnitbyProID]
(
@proID INT
)
RETURNS NVARCHAR(50)
AS
BEGIN
-- Declare the return variable here
DECLARE @Unit NVARCHAR(50) -- Add the T-SQL statements to compute the return value here
SELECT @Unit=Unit FROM dbo.BiotbProduct WHERE ProID=@proID -- Return the result of the function
RETURN @Unit END

构建查询打印的视图数据:

CREATE VIEW [dbo].[View_PurchaseInfoPrint]
AS
SELECT
SendComName=dbo.getCompanyNameByCompanyID(SendComID),
AppUserName=dbo.getUserNameByUserID(AppUserID),
AuditingUser=dbo.getUserNameByUserID(AcceptUserid),
stockUserName=dbo.getUserNameByUserID(Stockuserid),
StockName=dbo.FN_getStockNameByStockID(StockID),
StockDate=dbo.Fn_getSotckTimeByPurchaseID(PurchaseID),
* FROM dbo.BioPurchaseAppInfo CREATE VIEW [dbo].[View_PurchaseBatchInfoPrint]
AS
SELECT
    ProName,
    Spec=dbo.FN_getProSpecbyProID(ProID),
    MadeEnterprise=dbo.FN_getMadeEnterpriseByProID(ProID),
    Unit=dbo.FN_getProUnitbyProID(ProID),
    ProCount,
    ProPrice,
    ProBatchPriceTotal=(ProPrice*realityProCount),
    InvoicePrice,
    PurchaseProID,
    PurchaseID,
    ProID,
    makeDate,
    batchNum,    
    expirationDate,
    ProBatchID,
    stockDate,
    boxNum,
    BatchProCount,
    realityProCount    
FROM
    View_PurchaseProBatchInfo

根据仓库编号查询仓库名称:

-- Description:	根据仓库编号查询仓库名称
-- =============================================
CREATE FUNCTION [dbo].[FN_getStockNameByStockID]
(
-- Add the parameters for the function here
@stockID INT
)
RETURNS NVARCHAR(100)
AS
BEGIN DECLARE @StockName NVARCHAR(100)
SELECT @StockName=StockName FROM dbo.BioErpStockTable
WHERE ID=@stockID
RETURN @StockName END

打印的前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RuKuPrint.aspx.cs" Inherits="BioErpWeb.Print.RuKuPrint" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>入库(验收、通知)单打印</title>
<link href="../Styles/Print.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function setTbConSame(control) {
var usernames = document.getElementsByName("username");
if (usernames.length != 0) {
for (var i = 0; i < usernames.length; i++) {
usernames[i].value = control.value;
}
}
}
</script> </head> <body>
<form id="form1" runat="server" style="margin:0; padding:0;" >
<table>
<%
//产品购进单基本信息(1条)
System.Data.DataSet ds = GetDataSet();
//产品批号信息(多条)
System.Data.DataSet ds1 = this.GetProBatchsDataSet();
int mypage = 0; if ((ds1.Tables[0].Rows.Count) % 5 == 0)
{
mypage = (int)((ds1.Tables[0].Rows.Count) / 5);
}
else
{
mypage = ((int)((ds1.Tables[0].Rows.Count) / 5)) + 1;
} decimal mon = 0;
for (int n = 0; n < ds1.Tables[0].Rows.Count; n++)
{
mon += Convert.ToDecimal(ds1.Tables[0].Rows[n]["ProBatchPriceTotal"].ToString().Trim());
}
//Convert.ToDecimal(mon); int x = ds1.Tables[0].Rows.Count; //绑定固定的联系人或者制单人名 for (int i = 0; i < x;)
{
%>
<tr>
<td>
<table style="height: 310px; width: 210mm;" align="left"
border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="24mm" width="223mm">
<table border="0" cellpadding="0" cellspacing="0"
style="height: 20mm; width: 210mm;" align="left">
<tr>
<td colspan="6" style="font-size: larger; font-weight: bold"
align="center" class="style17">
<font size="4"><%=ds.Tables[0].Rows[0]["OrderCom"]%>入库(验收、通知)单</font></td>
</tr>
<tr>
<td align="right" width="75px" height="8mm" >
<font style="font-family: 宋体; font-size:12px;">发货单位:</font></td>
<td align="left" width="254px">
<font style="font-family: 宋体; font-size:12px;"><%=ds.Tables[0].Rows[0]["SendComName"]%></font>
</td>
<td align="right" width="75px" >
<font style="font-family: 宋体; font-size:12px;">入库方式:</font></td>
<td align="left" width="231px" >
<font style="font-family: 宋体; font-size:12px;"><%=ds.Tables[0].Rows[0]["sendType"]%></font></td>
<td align="right" width="75px" >
<font style="font-family: 宋体; font-size:12px;">系统单号:</font></td>
<td align="left" >
<font style="font-family: 宋体; font-size:12px;"><%=DateTime.Now.ToString("yyyyMMddhhmmss")+ds.Tables[0].Rows[0]["PurchaseID"]%></font></td>
</tr>
<tr>
<td align="right" height="8mm" >
<font style="font-family: 宋体; font-size:12px;">仓 库:</font></td>
<td align="left" width="254px" >
<%=ds.Tables[0].Rows[0]["StockName"]%></td>
<td align="right" >
<font style="font-family: 宋体; font-size:12px;">入库时间:</font></td>
<td align="left" width="231px">
<font style="font-family: 宋体; font-size:12px;"><%=Convert.ToDateTime(ds.Tables[0].Rows[0]["StockDate"]).ToString("yyyy-MM-dd")%></font></td>
<td align="right">
<font style="font-family: 宋体; font-size:12px;">自定义单号:</font></td>
<td align="left">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" height="43mm">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top" height="43mm" class="style8">
<table align="left" border="0" cellpadding="0" cellspacing="0"
class="Prinaround">
<tr align="center" valign="middle" style="height: 6mm">
<td width="40px" class="Printright" height="6mm">
<font style="font-family: 宋体; font-size:12px;">   </font></td>
<td class="style16">
<font style="font-family: 宋体; font-size:12px;">商品名称</font></td>
<td class="style14">
<font style="font-family: 宋体; font-size:12px;">规 格</font></td>
<td class="style22">
<font style="font-family: 宋体; font-size:12px;">生产企业</font></td>
<td class="style23">
<font style="font-family: 宋体; font-size:12px;">单位</font></td>
<td class="style10">
<font style="font-family: 宋体; font-size:12px;">数量</font></td>
<td class="style28">
<font style="font-family: 宋体; font-size:12px;">单价</font></td> <td class="style18">
<font style="font-family: 宋体; font-size:12px;">金额</font></td>
<td class="style29">
<font style="font-family: 宋体; font-size:12px;">生产日期</font></td>
<td class="style26">
<font style="font-family: 宋体; font-size:12px;">批号</font></td>
<td class="style27">
<font style="font-family: 宋体; font-size:12px;">有效期</font></td> </tr>
<%
decimal currentmoney = 0;
for (int j = 0; j < 5 && i < x; j++, i++)
{
currentmoney += Convert.ToDecimal(ds1.Tables[0].Rows[i]["ProBatchPriceTotal"]); %>
<tr align="center" valign="middle" style="height: 6mm">
<td class="Printright" height="6mm">
<table><tr><td> <font style="font-family: 宋体; font-size:12px;"> <%=i+1 %></font></td></tr></table></td>
<td class="style16">
<font style="font-family: 宋体; font-size:12px;"><span><%=ds1.Tables[0].Rows[i]["ProName"]%> </span></font></td>
<td class="style14">
<font style="font-family: 宋体; font-size:11px;"><span><%=ds1.Tables[0].Rows[i]["Spec"]%></span></font></td>
<td class="style22">
<font style="font-family: 宋体; font-size:11px;"><span><%=ds1.Tables[0].Rows[i]["MadeEnterprise"]%></span></font></td>
<td class="style23">
<font style="font-family: 宋体; font-size:11px;"><span><%=ds1.Tables[0].Rows[i]["Unit"]%></span></font></td>
<td class="style10">
<font style="font-family: 宋体; font-size:12px;"><span><%=ds1.Tables[0].Rows[i]["realityProCount"]%></span></font></td>
<td class="style28">
<font style="font-family: 宋体; font-size:12px;"><span><%=Convert.ToDecimal(ds1.Tables[0].Rows[i]["ProPrice"]).ToString("0.00")%></span></font></td>
<td class="style18">
<font style="font-family: 宋体; font-size:12px;"><span><%=Convert.ToDecimal(ds1.Tables[0].Rows[i]["ProBatchPriceTotal"]).ToString("0.00")%></span></font></td>
<td class="style29">
<font style="font-family: 宋体; font-size:12px;"><span><%=Convert.ToDateTime(ds1.Tables[0].Rows[i]["makeDate"]).ToString("yyyy-MM-dd")%></span></font></td>
<td class="style26">
<font style="font-family: 宋体; font-size:12px;"><span><%=ds1.Tables[0].Rows[i]["batchNum"]%></span></font></td>
<td class="style27">
<font style="font-family: 宋体; font-size:12px;"><span><%=Convert.ToDateTime(ds1.Tables[0].Rows[i]["expirationDate"]).ToString("yyyy-MM-dd")%></span></font></td> </tr>
<%
}
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="18mm" valign="top">
<table border="0" cellpadding="0" cellspacing="0"
style="height: 21mm; width: 770px;">
<tr>
<td colspan="2" class="style20">
<font style="font-family:font-family: 宋体; font-size:12px;">本单入库金额小计:<%=CommTool.StringHandler.CmycurD(currentmoney)+"(¥"+currentmoney.ToString("0.00")+")" %></font></td>
<td colspan="5" class="style20" >
<font style="font-family: 宋体; font-size:12px;">整单入库金额合计:<%=CommTool.StringHandler.CmycurD(mon)+"(¥"+mon.ToString("0.00")+")"%></font></td>
</tr>
<tr>
<td class="style21" >
<font style="font-family: 宋体; font-size:12px;">验收结论:合格</font></td>
<td class="style21">
<font style="font-family: 宋体; font-size:12px;">验收人:<input id="Text3" maxlength="6" style="border-width:0px; border-color:Transparent ; width:50px; font-family:宋体 ; font-size:12px;" value='<%=ds.Tables[0].Rows[0]["AuditingUser"]%>' /></font>
</td>
<td class="style21">
<font style="font-family: 宋体; font-size:12px;">送货人:<input id="senduser" maxlength="6" style="border-width:0px; border-color:Transparent ; width:50px; font-family:宋体 ; font-size:12px;" value="" /></font>
</td>
<td class="style21">
<font style="font-family: 宋体; font-size:12px;">保管员:<input id="stockuser" maxlength="6" style="border-width:0px; border-color:Transparent ; width:50px; font-family:宋体 ; font-size:12px;" value='<%=ds.Tables[0].Rows[0]["stockUserName"]%>'/></font>
</td>
<td colspan="2" class="style21">
<font style="font-family: 宋体; font-size:12px;">制单人:<input id="appuser" name="username" maxlength="6" onchange="setTbConSame(this)" style="border-width:0px; border-color:Transparent ; width:50px; font-family:宋体 ; font-size:12px;" value='<%=ds.Tables[0].Rows[0]["AppUserName"] %>' /></font>
</td>
</tr>
<tr>
<td height="6mm">
<font style="font-family: 宋体; font-size:12px;">白 联:存根联</font></td>
<td>
<font style="font-family: 宋体; font-size:12px;">红 联:财务联</font></td>
<td>
<font style="font-family: 宋体; font-size:12px;">黄 联:库房</font></td>
<td>
</td>
<td>
<font style="font-family: 宋体; font-size:12px;">P.<%=((int)(i-1)/5)+1 %>/<%=mypage%></font></td>
</tr>
</table> </td>
</tr>
</table>
<%
}
%>
</td>
</tr>
</table>
</form>
</body>
</html>

后端代码:

  protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["purchaseid"] != null)
{ }
else
{
Response.Redirect("ProPurchaseShow.aspx");
return;
}
} /// <summary>
/// 获取采购表单基本信息
/// </summary>
/// <returns></returns>
public DataSet GetDataSet()
{
string id = Request.QueryString["purchaseid"].ToString();
DataSet ds= SqlComm.GetDataByCondition("dbo.View_PurchaseInfoPrint", "*", "PurchaseID=" + id);
return ds;
}
/// <summary>
/// 采购单相应批号信息
/// </summary>
/// <returns>DataSet</returns>
public DataSet GetProBatchsDataSet()
{
string id = Request.QueryString["purchaseid"].ToString();
DataSet ds = SqlComm.GetDataByCondition("dbo.View_PurchaseBatchInfoPrint", "*", "PurchaseID=" + id);
return ds;
}

ERP打印入库单(四十)的更多相关文章

  1. ERP退货系统管理(四十五)

    添加的存储过程:(添加退货申请信息的存储过程) CREATE PROCEDURE [dbo].[BioBackSendGoods_ADD] @SendBackID INT OUTPUT, ), @Ap ...

  2. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之四(四十)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  3. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之六(四十二)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  4. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之八(四十四)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  5. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之九(四十五)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  6. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十(四十六)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  7. abp(net core)+easyui+efcore实现仓储管理系统——入库管理之十二(四十八)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  8. abp(net core)+easyui+efcore实现仓储管理系统——出库管理之一(四十九)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

  9. ERP出入库进阶操作与子流程--开源软件诞生28

    赤龙ERP出入库进阶讲解--第28篇 用日志记录"开源软件"的诞生 [进入地址 点亮星星]----祈盼着一个鼓励 博主开源地址: 码云:https://gitee.com/redr ...

随机推荐

  1. python---RabbitMQ(3)exchange中关键字发送direct(组播)

    设置关键字,交换机根据消费者传递的关键字判断是否与生产者的一致,一致则将数据传递给消费者 可以实现对消息分组 生产者: # coding:utf8 # __author: Administrator ...

  2. 什么是cap

    cap理论是分布式系统中非常重要的一个理念 什么是cap理论: Consistency一致性 Availability可用性 Partition-tolerance分区容忍性 CP: 高一致性C和分区 ...

  3. POJ 2970 The lazy programmer

    The lazy programmer Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 2785   Accepted: 70 ...

  4. Servlet总结(一)

    一.Servlet了解 1.Servlet全称Java Servlet,是用java编写的独立于平台和协议的服务器端应用程序,运行于服务器,采用请求-响应模式提供Web服务 2.Servlet实现过程 ...

  5. [PageNofM]一直显示数字+0

    解决办法: Options->ReportOptions->DoublePass勾选即可

  6. EntityFramework用法探索(八)事务处理

    使用 前文中描述的Retail示例 ,在Customer对象的Mapping中设置Name属性:我们构造一个有效的Customer对象,再构造一个无效的Name属性为空的对象. DomainModel ...

  7. js正则匹配table,img及去除各种标签问题

    //获取公示栏内容 s = "$row.detail$"; mainContent =s; //如果有多个table使用下面注释的正则只会匹配成一个table //var tabR ...

  8. luogu P3193 [HNOI2008]GT考试

    传送门 单串匹配显然用\(kmp\) 一个暴力的dp是设\(f_{i,j}\),表示前\(i\)位,正在匹配给定串第\(j\)位的方案,转移就枚举下一位放什么,然后使用\(kmp\)看会匹配到给定串的 ...

  9. HDU2444 The Accomodation of Students【匈牙利算法】

    题意: 有n个学生,有m对人是认识的,每一对认识的人能分到一间房,问能否把n个学生分成两部分,每部分内的学生互不认识,而两部分之间的学生认识.如果可以分成两部分,就算出房间最多需要多少间,否则就输出N ...

  10. php 设置中文 cookie, js获取

    参考链接:http://www.nowamagic.net/librarys/veda/detail/1271 http://www.ruanyifeng.com/blog/2008/06/base6 ...