import React, {Component} from 'react';
import {
View,
Text,
TextInput,
TouchableOpacity,
StyleSheet,
Dimensions,
PixelRatio,
Modal,
FlatList,
Image,
} from 'react-native';
import {RoundingData} from '../../source/inspect/inspect';
import {List, SwipeAction} from '@ant-design/react-native';
import {RequestNetwork} from '../../data/encryption';
import {RetrieveData, StorageData} from '../../data/storage';
import invoice_head_css from './invoice_head_css';
import public_css from '../../source/css/public_css';
import { ToastShow } from "../../components/toast/toast";
export default class invoice_head_information extends Component {
constructor(props) {
super(props);
this.props.navigation.dangerouslyGetParent().setOptions({
tabBarVisible: false,
});
this.state = {
listData: this.props.route.params.listData,
customerName: this.props.route.params.customerName,
customerEntTaxId: this.props.route.params.customerEntTaxId,
address: this.props.route.params.address,
contactPhone: this.props.route.params.contactPhone,
bankName: this.props.route.params.bankName,
bankAccountNo: this.props.route.params.bankAccountNo,
customerEmail: this.props.route.params.customerEmail,
customerMobile: this.props.route.params.customerMobile,
remark: this.props.route.params.remark,
belongEntTaxId: this.props.route.params.belongEntTaxId,
entName: this.props.route.params.entName,
product_number_total: this.props.route.params.product_number_total,
amount_total: this.props.route.params.amount_total,
tax_rate_total: this.props.route.params.tax_rate_total,
};
}
render() {
return (
客户姓名:
{this.state.customerName}
客户企业税号:
{this.state.customerEntTaxId}
联系电话:
{this.state.contactPhone}
地址:
{this.state.address}
开户银行:
{this.state.bankName}
银行账号:
{this.state.bankAccountNo}
客户邮箱:
{this.state.customerEmail}
客户手机号:
{this.state.customerMobile}
备注:
{this.state.remark}
产品名称
产品数量
规格型号
单价
税率(%)
this.renderItem(item)}
/>
共{this.state.product_number_total}个产品
开票金额:
{RoundingData(parseFloat(this.state.amount_total)).replace(
/(\d)(?=(\d{3})+(?:\.\d+)?$)/g,
'$1,',
)}
元
税额:{RoundingData(parseFloat(this.state.tax_rate_total))}
this.submitData()}>
提交
);
}
//提交开票信息
submitData = async () => {
let account = await RetrieveData('account');
let token = await RetrieveData('token');
let ent = await RetrieveData('defaultEnt');
if (token && account && ent) {
let entInformation = JSON.parse(ent);
const url = '/sys/invoice_info/save';
let response = await RequestNetwork(
url,
token,
{
interactType: 1,
interactTypeDetail: this.state.customerEmail,
invoiceWay: 1,
invoiceCategory: 1,
cmdParam: {
REQUEST_COMMON_FPKJ: {
KPLX: 0, //开票类型 0-蓝字发票;1-红字发票
FPZL: 1, //发票种类 1.增值税普通电子发票 2.增值税电子专用发票 3.增值税普通纸质发票 4 增值税专用纸质发票
TTLX: 2, //收票客户抬头类型 1:个人 2:企业
KPF_NSRSBH: entInformation.entTaxId, //开票方纳税人识别号
KPF_MC: entInformation.entName, //开票方名称
KPF_DZ: entInformation.entAddress, //开票方地址
KPF_DH: entInformation.entAddress, //开票方电话
KPF_YHZH: '', //开票方银行账号
KPF_KHHMC: '', //开票方开户行名称
SPF_NSRSBH: this.state.customerEntTaxId, //收票方纳税人识别号
SPF_MC: this.state.customerName, //收票方名称
SPF_DH: this.state.contactPhone.toString(), //收票方电话
SPF_DZ: this.state.address.toString(), //收票方地址
SPF_YHZH: this.state.bankAccountNo, //收票方银行账号
SPF_KHHMC: '', //收票方开户行名称
KPR: account, //开票人
SKR: this.state.payees, //收款人
FHR: this.state.reviewers, //复核人
YFP_DM: '', //原发票代码
YFP_HM: '', //原发票号码
JSHJ: RoundingData(parseFloat(this.state.amount_total)), //价税合计
HJJE: RoundingData(
this.state.amount_total - this.state.tax_rate_total,
), //合计金额
HJSE: RoundingData(this.state.tax_rate_total), //合计税额
BZ: this.state.remark, //备注
HYLX: 0, //发票行性质 0 正常行、1 折扣行、2 被折扣行
TSPZ: '00', //特殊票种标识 “00”不是 “01”农产品销售“02”农产品收购“06”抵扣通行费“07”其它通行费“08”成品油销售说明:如果非特殊票种此节点可以没有。
// FPQQLSH: '',
// KPLX: '0',
// BMB_BBH: '',
// ZSFS: '0',
// XSF_NSRSBH: entInformation.entTaxId,
// XSF_MC: entInformation.entName,
// XSF_DZDH: entInformation.entAddress,
// XSF_YHZH: '',
// GMF_NSRSBH: this.state.customerEntTaxId,
// GMF_MC: this.state.customerName,
// GMF_DZDH:
// this.state.address.toString() +
// this.state.contactPhone.toString(),
// GMF_YHZH: this.state.bankAccountNo,
// GMF_SJH: '',
// GMF_DZYX: this.state.customerEmail,
// FPT_ZH: '',
// WX_OPENID: '',
// KPR: account,
// SKR: '',
// FHR: '',
// YFP_DM: '',
// YFP_HM: '',
// JSHJ: RoundingData(parseFloat(this.state.amount_total)),
// HJJE: RoundingData(
// this.state.amount_total - this.state.tax_rate_total,
// ),
// HJSE: RoundingData(this.state.tax_rate_total),
// KCE: '',
// BZ: this.state.remark,
// HYLX: '0',
// BY1: '',
// BY2: '',
// BY3: '',
// BY4: '',
// BY5: '',
// BY6: '',
// BY7: '',
// BY8: '',
// BY9: '',
// BY10: '',
// WX_ORDER_ID: '',
// WX_APP_ID: '',
// ZFB_UID: '',
// // TSPZ: '',
// QJ_ORDER_ID: '',
// WX_GROUP_ID: '',
COMMON_FPKJ_XMXXS: {
COMMON_FPKJ_XMXX: this.state.listData,
}, // 产品列表
},
},
mobile: account,
reqChannel: 3,
},
false,
1,
);
if (response) {
if (response.code == 0) {
ToastShow(1, '开票成功!');
this.props.navigation.popToTop();
}
} else {
ToastShow(1, '服务器故障!');
}
}
};
//产品列表
renderItem = data => (
{data.item.XMMC}
{data.item.XMSL}
{data.item.GGXH}
{data.item.XMDJ}
{data.item.SL * 100}
);
//初始化数据
initData = () => {
this.setState({
customer_name: '',
ent_tax_id: '',
contact_phone: '',
address: '',
bank_account: '',
});
};
}