|
@@ -7,6 +7,8 @@ import { ProjectManageArchives } from 'app/entity/project-manage-archives/projec
|
|
import { ProjectManageArchivesService } from 'app/services/project-manage-archives/project-manage-archives.service';
|
|
import { ProjectManageArchivesService } from 'app/services/project-manage-archives/project-manage-archives.service';
|
|
import { ManagerPaymentAndReceiptSlipService } from 'app/services/down-payment-management/manager-payment-and-receipt-slip.service';
|
|
import { ManagerPaymentAndReceiptSlipService } from 'app/services/down-payment-management/manager-payment-and-receipt-slip.service';
|
|
import { I18NService } from '@core';
|
|
import { I18NService } from '@core';
|
|
|
|
+import { InvoiceManagePurchase } from 'app/entity/invoice-management/invoice-manage-purchase';
|
|
|
|
+import { InvoiceManagePurchaseService } from 'app/services/invoice-management/invoice-manage-purchase.service';
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
selector: 'app-down-payment-management-receipt-add',
|
|
selector: 'app-down-payment-management-receipt-add',
|
|
@@ -28,11 +30,15 @@ import { I18NService } from '@core';
|
|
],
|
|
],
|
|
})
|
|
})
|
|
export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
- constructor(private fb: FormBuilder, private projectManageArchivesService: ProjectManageArchivesService,
|
|
+ constructor(
|
|
- private managerPaymentAndReceiptSlipService:ManagerPaymentAndReceiptSlipService,
|
|
+ private fb: FormBuilder,
|
|
- private nzNotificationService:NzNotificationService,
|
|
+ private projectManageArchivesService: ProjectManageArchivesService,
|
|
- private i18NService:I18NService,
|
|
+ private managerPaymentAndReceiptSlipService: ManagerPaymentAndReceiptSlipService,
|
|
- private drawerRef:NzDrawerRef) {}
|
|
+ private nzNotificationService: NzNotificationService,
|
|
|
|
+ private i18NService: I18NService,
|
|
|
|
+ private drawerRef: NzDrawerRef,
|
|
|
|
+ private invoiceManagePurchaseService:InvoiceManagePurchaseService
|
|
|
|
+ ) {}
|
|
|
|
|
|
ngOnInit(): void {
|
|
ngOnInit(): void {
|
|
|
|
|
|
@@ -40,7 +46,11 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
proId: [null, [Validators.required]],
|
|
proId: [null, [Validators.required]],
|
|
});
|
|
});
|
|
this.isLoadingSave = true;
|
|
this.isLoadingSave = true;
|
|
- this.getProList().then(() => {
|
|
+
|
|
|
|
+ this.getProList().then(()=>{
|
|
|
|
+
|
|
|
|
+ return this.getInvoiceIdList();
|
|
|
|
+ }).then(() => {
|
|
this.isLoadingSave = false;
|
|
this.isLoadingSave = false;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -51,7 +61,7 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
proList = [];
|
|
proList = [];
|
|
proArchivesList = [];
|
|
proArchivesList = [];
|
|
coArchivesList = [];
|
|
coArchivesList = [];
|
|
- invoiceIdList=[];
|
|
+ invoiceIdList = [];
|
|
|
|
|
|
formatterDollar = (value: number) => {
|
|
formatterDollar = (value: number) => {
|
|
if (value) {
|
|
if (value) {
|
|
@@ -61,6 +71,24 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
parserDollar = (value: string) => value.replace('$ ', '');
|
|
parserDollar = (value: string) => value.replace('$ ', '');
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ * 获取销售发票下拉数据
|
|
|
|
+ */
|
|
|
|
+ getInvoiceIdList(){
|
|
|
|
+ return new Promise((resolve)=>{
|
|
|
|
+ let invoiceManagePurchase=new InvoiceManagePurchase();
|
|
|
|
+ invoiceManagePurchase.pageSize=20000;
|
|
|
|
+ invoiceManagePurchase.type="2";
|
|
|
|
+ invoiceManagePurchase.pkOrg=sessionStorage.getItem("pkOrg");
|
|
|
|
+ this.invoiceManagePurchaseService.getList(invoiceManagePurchase).then((response)=>{
|
|
|
|
+ if(response.success){
|
|
|
|
+ this.invoiceIdList=response.result.records
|
|
|
|
+ }
|
|
|
|
+ resolve();
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
* 获取项目下拉数据
|
|
* 获取项目下拉数据
|
|
@@ -94,46 +122,70 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
this.managerPaymentAndReceiptSlip.cusCode = project.cusCode;
|
|
this.managerPaymentAndReceiptSlip.cusCode = project.cusCode;
|
|
this.managerPaymentAndReceiptSlip.cusName = project.cusName;
|
|
this.managerPaymentAndReceiptSlip.cusName = project.cusName;
|
|
|
|
|
|
- this.getLineList()
|
|
+ this.getLineList();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- getLineList(){
|
|
+ getLineList() {
|
|
|
|
|
|
- let projectManageArchives={proArchivesId:this.managerPaymentAndReceiptSlip.proId,planType:"1"};
|
|
+ let projectManageArchives = { proArchivesId: this.managerPaymentAndReceiptSlip.proId, planType: '1' };
|
|
- this.projectManageArchivesService.getLineList(projectManageArchives).then((response)=>{
|
|
+ this.projectManageArchivesService.getLineList(projectManageArchives).then(response => {
|
|
- if(response.success){
|
|
+ if (response.success) {
|
|
- this.coArchivesList=response.result
|
|
+ this.coArchivesList = response.result;
|
|
}
|
|
}
|
|
- })
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
* 条件选择事件
|
|
* 条件选择事件
|
|
* 获取条线名称、获取里程碑数据
|
|
* 获取条线名称、获取里程碑数据
|
|
*/
|
|
*/
|
|
- coArchivesIdChange(data){
|
|
+ coArchivesIdChange(data) {
|
|
- if(data.coArchivesId){
|
|
+ if (data.coArchivesId) {
|
|
|
|
|
|
this.coArchivesList.forEach(element => {
|
|
this.coArchivesList.forEach(element => {
|
|
- if(data.coArchivesId===element.id){
|
|
+ if (data.coArchivesId === element.id) {
|
|
- data.coArchivesName=element.planName;
|
|
+ data.coArchivesName = element.planName;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
+ this.getMilList(data);
|
|
-
|
|
+ }
|
|
-
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+ * 获取里程碑下拉数据
|
|
-
|
|
+ */
|
|
-
|
|
+ getMilList(data) {
|
|
-
|
|
+
|
|
-
|
|
+ let where = { businessId: data.coArchivesId };
|
|
|
|
+ this.projectManageArchivesService.getMileNameById(where).then(response => {
|
|
|
|
+ if (response.success) {
|
|
|
|
+ data.proArchivesIdList = response.result;
|
|
|
|
+
|
|
|
|
+ if(data.proArchivesId){
|
|
|
|
+ this.proBusinessChange(data);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ * 里程碑选择事件
|
|
|
|
+ */
|
|
|
|
+ proBusinessChange(data) {
|
|
|
|
+ if (data.proArchivesId) {
|
|
|
|
+ data.proArchivesIdList.forEach(element => {
|
|
|
|
+ if (element.mileId === data.proArchivesId) {
|
|
|
|
+ data.proArchivesMilestone = element.mileName;
|
|
|
|
+ data.coPrvice = element.price;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.getCoPrviceTotal();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -167,7 +219,7 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
|
|
|
|
* 金额填写事件
|
|
* 金额填写事件
|
|
*/
|
|
*/
|
|
- coPrviceKeyUp(){
|
|
+ coPrviceKeyUp() {
|
|
|
|
|
|
this.getCoPrviceTotal();
|
|
this.getCoPrviceTotal();
|
|
}
|
|
}
|
|
@@ -175,19 +227,19 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
|
|
|
|
* 获取收款金额合计
|
|
* 获取收款金额合计
|
|
*/
|
|
*/
|
|
- getCoPrviceTotal(){
|
|
+ getCoPrviceTotal() {
|
|
|
|
|
|
- if(!this.itemDataList){
|
|
+ if (!this.itemDataList) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- let coPrviceTotal=0;
|
|
+ let coPrviceTotal = 0;
|
|
this.itemDataList.forEach(element => {
|
|
this.itemDataList.forEach(element => {
|
|
- if(element.coPrvice&&!isNaN(Number(element.coPrvice))){
|
|
+ if (element.coPrvice && !isNaN(Number(element.coPrvice))) {
|
|
- coPrviceTotal=coPrviceTotal+Number(element.coPrvice);
|
|
+ coPrviceTotal = coPrviceTotal + Number(element.coPrvice);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- this.managerPaymentAndReceiptSlip.totalPrice=coPrviceTotal;
|
|
+ this.managerPaymentAndReceiptSlip.totalPrice = coPrviceTotal;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -200,11 +252,28 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
this.validateForm.controls[i].updateValueAndValidity();
|
|
this.validateForm.controls[i].updateValueAndValidity();
|
|
}
|
|
}
|
|
let valid = this.validateForm.valid;
|
|
let valid = this.validateForm.valid;
|
|
- if(valid){
|
|
+ if (valid) {
|
|
- this.managerPaymentAndReceiptSlip.type="1";
|
|
+ this.managerPaymentAndReceiptSlip.type = '1';
|
|
- this.managerPaymentAndReceiptSlip.pkOrg=sessionStorage.getItem("pkOrg");
|
|
+ this.managerPaymentAndReceiptSlip.pkOrg = sessionStorage.getItem('pkOrg');
|
|
- this.managerPaymentAndReceiptSlip.detailList=this.itemDataList;
|
|
+ this.managerPaymentAndReceiptSlip.detailList = this.itemDataList;
|
|
- this.managerPaymentAndReceiptSlipService.add(this.managerPaymentAndReceiptSlip).then((response)=>{
|
|
+
|
|
|
|
+ if(this.itemDataList&&this.itemDataList.length>0){
|
|
|
|
+ this.itemDataList.forEach(element => {
|
|
|
|
+
|
|
|
|
+ if(element.invoiceId){
|
|
|
|
+ this.invoiceIdList.forEach(invoice => {
|
|
|
|
+ if(invoice.id===element.invoiceId){
|
|
|
|
+ element.invoice=invoice.proName;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }else {
|
|
|
|
+ this.nzNotificationService.warning('明细数据必填', '');
|
|
|
|
+ this.isLoadingSave=false;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.managerPaymentAndReceiptSlipService.add(this.managerPaymentAndReceiptSlip).then(response => {
|
|
if (response.success) {
|
|
if (response.success) {
|
|
|
|
|
|
this.isLoadingSave = false;
|
|
this.isLoadingSave = false;
|
|
@@ -216,7 +285,7 @@ export class DownPaymentManagementReceiptAddComponent implements OnInit {
|
|
this.isLoadingSave = false;
|
|
this.isLoadingSave = false;
|
|
this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
this.nzNotificationService.error(this.i18NService.fanyi('save.not'), '');
|
|
}
|
|
}
|
|
- })
|
|
+ });
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|