const IssuePreview: FunctionComponent<Props> = (props: Props) => {
const { invoiceData } = props;
const {
invoiceVariety,
totalExcludingTaxAmount,
totalTax,
totalPriceTaxAmount,
lines,
remark,
userRemark,
invoiceSourceType,
} = invoiceData;
const title = invoiceVariety && invoiceVarietyConfig[invoiceVariety];
const renderHeader = () => {
return (
<div className={styles.invoice_top}>
<Row type="flex" align="bottom" style={{ height: '80px' }}>
<Col span={8}>
{totalPriceTaxAmount && totalPriceTaxAmount < 0 && (
<div className={styles.negative}>
<span>销 项 负 数</span>
</div>
)}
{invoiceVariety === '2' && (
<div style={{ textAlign: 'center' }}>
<span style={{ marginRight: '90px' }}>校验码:</span>
</div>
)}
{['51', '52'].includes(invoiceVariety) && <span>机器编号:</span>}
</Col>
<Col span={8}>
<div style={{ textAlign: 'center' }}>
<span className={styles.top_middle}>{title}</span>
</div>
</Col>
<Col span={8}>
<div>
{['0', '2'].includes(invoiceVariety) && (
<>
<div style={{ fontSize: '24px' }}>No</div>
<div style={{ textAlign: 'center' }}>开票日期:</div>
</>
)}
{['51', '52'].includes(invoiceVariety) && (
<>
<div>发票代码:</div>
<div>发票号码:</div>
<div>开票日期:</div>
<div>校 验 码:</div>
</>
)}
</div>
</Col>
</Row>
</div>
);
};
return (
<>
{invoiceVariety === '41' ? (
<>
<div className={styles.ticketTile}>
<div>
<span>增值税普通发票(卷票)</span>
</div>
<div className={styles.ticketSubTit}>
<span>发 票 联</span>
</div>
</div>
<div className={styles.contain}>
<table className={styles.ticketTable}>
<tr>
<td colSpan={4} className={styles.ticketLabel}>
发票代码:
</td>
</tr>
<tr>
<td colSpan={4} className={styles.ticketLabel}>
发票代码:
</td>
</tr>
<tr>
<td width="50%" className={styles.ticketLabel}>
机打号码:
</td>
<td className={styles.ticketLabel}>机器编号:</td>
</tr>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>销售方名称:</span>
<span className={styles.ticketField}>{invoiceData.sellerName}</span>
</td>
</tr>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>纳税人识别号:</span>
<span className={styles.ticketField}>{invoiceData.sellerTaxpayerNumber}</span>
</td>
</tr>
<tr>
<td width="50%" className={styles.ticketLabel}>
开票日期:
</td>
<td>
<span className={styles.ticketLabel}>收款员:</span>
<span className={styles.ticketField}>{invoiceData.payeeName}</span>
</td>
</tr>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>购买方名称:</span>
<span className={styles.ticketField}>{invoiceData.buyerName}</span>
</td>
</tr>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>纳税人识别号:</span>
<span className={styles.ticketField}>{invoiceData.buyerTaxpayerNumber}</span>
</td>
</tr>
<tr>
<td colSpan={4}>
<table width="100%" style={{ marginTop: 20 }}>
<tr>
<td width="25%" className={styles.ticketLabel}>
项目
</td>
<td width="25%" className={styles.ticketLabel}>
数量
</td>
<td width="25%" className={styles.ticketLabel}>
含税单价
</td>
<td width="25%" className={styles.ticketLabel}>
含税金额
</td>
</tr>
{!isEmpty(lines) &&
lines.map(item => {
return (
<tr>
<td>{item.projectName}</td>
<td valign="top">{item.quantity}</td>
<td valign="top">{unitPriceTax(item)}</td>
<td valign="top">{amountTax(item)}</td>
</tr>
);
})}
</table>
</td>
</tr>
<tr>
<td colSpan={4}>
<table width="100%" style={{ marginTop: 40, whiteSpace: 'pre-wrap' }}>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>备注:</span>
<span className={styles.ticketField}>{mark}</span>
</td>
</tr>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>合计金额(小写):</span>
<span className={styles.ticketField}>
{totalPriceTaxAmount && totalPriceTaxAmount.toFixed(2)}
</span>
</td>
</tr>
<tr>
<td colSpan={4}>
<span className={styles.ticketLabel}>合计金额(大写):</span>
<span className={styles.ticketField}>
{invoiceData.totalPriceTaxAmountUpper}
</span>
</td>
</tr>
<tr>
<td colSpan={4} className={styles.ticketLabel}>
校验码:
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</>
) : (
<div className={styles.background}>
{renderHeader()}
<div>
<table className={styles.invoiceTable}>
<tr>
<td className={styles.topSide}>购买方</td>
<td width="55%">
<span className={styles.label}>名    称:</span>
<span className={styles.labelField}>{invoiceData.buyerName}</span>
<br />
<span className={styles.label}>纳税人识别号:</span>
<span className={styles.labelField}>{invoiceData.buyerTaxpayerNumber}</span>
<br />
<span className={styles.label}>地 址、电 话:</span>
<span className={styles.labelField}>{invoiceData.buyerCompanyAddressPhone}</span>
<br />
<span className={styles.label}>开户行及账号:</span>
<span className={styles.labelField}>{invoiceData.buyerBankNumber}</span>
</td>
<td className={styles.topSide}>密码区</td>
<td />
</tr>
</table>
<table className={styles.goodTable}>
<tr style={{ textAlign: 'center' }}>
<td width="30%">
<span className={styles.goodLabel}>{thTitle}</span>
</td>
<td width="10%">
<span className={styles.goodLabel}>规格型号</span>
</td>
<td width="5%">
<span className={styles.goodLabel}>单位</span>
</td>
<td width="10%">
<span className={styles.goodLabel}>数量</span>
</td>
<td width="10%">
<span className={styles.goodLabel}>单价</span>
</td>
<td width="15%">
<span className={styles.goodLabel}>金额</span>
</td>
<td width="5%">
<span className={styles.goodLabel}>税率</span>
</td>
<td width="15%">
<span className={styles.goodLabel}>税额</span>
</td>
</tr>
{!isEmpty(lines) &&
lines.map(item => {
return (
<tr key={item.invoicingOrderLineId} className={styles.goodInfo}>
<td width="30%" align="left">
<span>{item.projectName}</span>
</td>
<td width="10%" align="left">
<span>{item.model}</span>
</td>
<td width="5%" align="center">
<span>{item.projectUnit}</span>
</td>
<td width="10%" align="right">
<span>{item.quantity}</span>
</td>
<td width="10%" align="right">
<span>{calcUnitPrice(item)}</span>
</td>
<td width="15%" align="right">
<span>{calcAmount(item)}</span>
</td>
<td width="5%" align="right">
<span>{calcTaxRate(item)}</span>
</td>
<td width="15%" align="right">
<span>{item.taxAmount}</span>
</td>
</tr>
);
})}
<tr className={styles.total}>
<td width="30%" align="center" className={styles.goodLabel}>
合计
</td>
<td width="10%" />
<td width="5%" />
<td width="10%" />
<td width="10%" />
<td width="15%" align="right">
<span>¥{totalExcludingTaxAmount}</span>
</td>
<td width="5%" />
<td width="15%" align="right">
<span>¥{totalTax}</span>
</td>
</tr>
<tr className={styles.goodBottom}>
<td align="center" className={styles.goodLabel}>
价税合计(大写)
</td>
<td colSpan={4} style={{ borderRight: 'none' }}>
{invoiceData.totalPriceTaxAmountUpper}
</td>
<td colSpan={3}>
<span className={styles.goodLabel}>(小写)</span>
<span>¥{totalPriceTaxAmount && totalPriceTaxAmount.toFixed(2)}</span>
</td>
</tr>
</table>
<table className={styles.sellerInfo}>
<tr>
<td className={styles.topSide}>销售方</td>
<td width="55%">
<span className={styles.label}>名    称:</span>
<span className={styles.labelField}>{invoiceData.sellerName}</span>
<br />
<span className={styles.label}>纳税人识别号:</span>
<span className={styles.labelField}>{invoiceData.sellerTaxpayerNumber}</span>
<br />
<span className={styles.label}>地 址、电 话:</span>
<span className={styles.labelField}>{invoiceData.sellerCompanyAddressPhone}</span>
<br />
<span className={styles.label}>开户行及账号:</span>
<span className={styles.labelField}>{invoiceData.sellerBankNumber}</span>
</td>
<td className={styles.topSide}>备注</td>
<td valign="top" style={{ padding: '0 4px' }}>
<span className={styles.remark}>{mark}</span>
</td>
</tr>
</table>
<table className={styles.bottomTable}>
<tr>
<td width="10%" align="right" className={styles.label}>
收款人:
</td>
<td width="15%" className={styles.labelField}>
{invoiceData.payeeName}
</td>
<td width="10%" align="right" className={styles.label}>
复核:
</td>
<td width="15%" className={styles.labelField}>
{invoiceData.reviewerName}
</td>
<td width="10%" align="right" className={styles.label}>
开票人:
</td>
<td width="15%" className={styles.labelField}>
{invoiceData.issuerName}
</td>
{invoiceVariety !== '52' && (
<td width="25%" className={styles.label}>
销售单位:(章)
</td>
)}
</tr>
</table>
</div>
</div>
)}
</>
);
};
.flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.containTable:extend(.flex) {
height: 54px;
.title {
margin: 0;
margin-right: 16px;
}
}
.tableTitleRight:extend(.flex) {
padding: 8px 0 8px 16px;
background: #eff6ff;
border-radius: 4px;
p {
margin: 0;
color: #5a6677;
}
span {
margin-right: 24px;
color: blue;
opacity: 1;
}
}
.customTable {
display: flex;
align-items: center;
justify-content: space-around;
padding-bottom: 16px;
}
.invoiceContainer:extend(.flex) {
justify-content: space-around;
width: 500px;
margin-top: 10px;
}
.background {
background-image: url('https://digi.aisino.com:8003/images/fpylbj.png');
background-repeat: no-repeat;
background-position: 55% 63%;
}
.invoice_top {
width: 100%;
color: #9e520a;
font-family: '楷体', serif;
font-size: 13px;
height: 80px;
}
.negative {
font-size: 18px;
font-weight: bold;
color: #000;
text-align: center;
font-family: '微软雅黑', serif;
span {
margin-left: 70px;
}
}
.top_left {
width: 28%;
}
.top_middle {
position: relative;
bottom: 50px;
color: #9e520a;
font-size: 26px;
line-height: 20px;
}
.top_right {
width: 30%;
text-align: right;
}
.invoiceTable {
width: 100%;
border-top: 1px solid #b88787;
border-left: 1px solid #b88787;
border-bottom: 1px solid #b88787;
td {
border-right: 1px solid #b88787;
border-bottom: 1px solid #b88787;
line-height: 25px;
}
}
.sellerInfo {
width: 100%;
border-left: 1px solid #b88787;
border-right: 1px solid #b88787;
border-bottom: 1px solid #b88787;
white-space: pre-wrap;
td {
border-right: 1px solid #b88787;
line-height: 25px;
}
}
.goodTable {
width: 100%;
border-left: 1px solid #b88787;
//border-right: 1px solid #b88787;
border-bottom: 0.5px solid #b88787;
td {
border-right: 1px solid #b88787;
}
}
.goodBottom {
td {
border-top: 1px solid #b88787;
padding: 0 4px;
}
}
.goodInfo {
td {
line-height: 28px;
padding: 0 4px;
}
}
.topSide {
width: 25px;
padding: 0 6px;
color: #9e520a;
}
.total {
td {
padding: 0 4px;
}
}
.label {
color: #9e520a;
padding: 0 4px;
font-family: '楷体', serif;
font-size: 14px;
}
.goodLabel {
color: #9e520a;
text-align: center;
line-height: 25px;
font-family: '楷体', serif;
font-size: 14px;
}
.labelField {
font-family: '微软雅黑', serif;
}
.code {
color: #000;
font-family: '微软雅黑', serif;
}
.remark {
font-family: '微软雅黑', serif;
//padding: 0 4px;
word-break: break-all;
}
.bottomTable {
width: 100%;
td {
line-height: 25px;
}
}
.ticketTile {
font-size: 18px;
color: #574b9d;
text-align: center;
}
.ticketSubTit {
margin-top: 20px;
margin-bottom: 10px;
font-weight: 700;
}
.contain {
margin: 0 auto;
padding: 20px;
border: 1px dashed rgb(204, 204, 204);
width: 500px;
line-height: 30px;
background-color: rgb(247, 247, 247);
}
.ticketTable {
width: 100%;
background-image: url('https://digi.aisino.com:8003/images/fpylbj.png');
background-repeat: no-repeat;
background-size: 135%;
background-position: center;
}
.ticketLabel {
font-size: 14px;
color: #9e520a;
}
.ticketField {
font-size: 14px;
color: #574b9d;
}
.invoiceModal {
width: calc(63vw) !important;
}