1
|
select * from txn_mobile_collection_header where col_no like '%ccmn1000003%'
|
2
|
select * from txn_mobile_collection_detail where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
3
|
select * from txn_mobile_collection_invoice where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
4
|
select * from txn_invoice_history_header where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'
|
5
|
select * from txn_invoice_history_detail where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'
|
6
|
select a.at_type, a.at_date,a.updated_by,* from txn_mobile_collection_header_at a where col_no like '%ccmn1000003%' order by a.at_date desc
|
7
|
|
8
|
select * from txn_mobile_collection_header where col_no like '%ccmn1000005%'
|
9
|
|
10
|
------------------------------------------------------------------------------------------
|
11
|
|
12
|
|
13
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------
|
14
|
|
15
|
------------------------------------------------------------------------------------------------------------------------------------------------
|
16
|
|
17
|
select a.at_type, a.at_date,a.updated_by,updated_date,created_by,created_date,* from txn_mobile_collection_header_at a where col_no like '%CCMN1000003%' order by a.at_date desc
|
18
|
select a.at_type, a.at_date,a.updated_by,updated_date,created_by,created_date,* from txn_mobile_collection_header_at a where col_no like '%CCMN1000005%' order by a.at_date desc
|
19
|
-- in the at table we notice that the created date
|
20
|
-- as I checked the created date are different
|
21
|
select * from txn_mobile_collection_header where col_no like '%ccmn1000003%'-- patchning has to be done
|
22
|
--patch total_cn_amount to 38.61 change the invoice 1817.64
|
23
|
select * from txn_invoice_history_header where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'--ccmn1000003
|
24
|
select * from txn_credit_note_history_header where credit_note_no like '%CN24/003116%'
|
25
|
|
26
|
select * from txn_mobile_collection_header where col_no like '%CCMN1000005%'
|
27
|
|
28
|
select * from txn_mobile_collection_detail where col_id = '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
29
|
select * from txn_mobile_collection_detail where col_id = '05bcf07b-a60b-4419-b3fc-572c3eef73f7'
|
30
|
-- collection detail_ id is different but amount is same
|
31
|
|
32
|
select * from txn_mobile_collection_invoice where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776'--ccmn1000003
|
33
|
select * from txn_mobile_collection_invoice where col_id= '05bcf07b-a60b-4419-b3fc-572c3eef73f7'-- CCMN1000005
|
34
|
-- one invoice have multiple collection
|
35
|
select * from txn_invoice_history_header where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'
|
36
|
select * from txn_invoice_history_detail where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'
|
37
|
select
|
38
|
308.88 +
|
39
|
77.22 +
|
40
|
77.22 +
|
41
|
178.20 +
|
42
|
463.32 +
|
43
|
178.20 +
|
44
|
267.30 +
|
45
|
267.30
|
46
|
|
47
|
-- have to check why these 2 collection have same invoice
|
48
|
|
49
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------
|
50
|
------patching
|
51
|
|
52
|
|
53
|
select a.updated_date,* from txn_mobile_collection_header a where col_no like '%ccmn1000003%' order by a.updated_date desc
|
54
|
|
55
|
select a.updated_date,a.at_date,* from txn_mobile_collection_header_at a where col_no like '%ccmn1000003%' order by a.at_date desc
|
56
|
--UPDATE txn_mobile_collection_header
|
57
|
--SET status = 'Pending',
|
58
|
-- total_cn_amt = 0,
|
59
|
-- total_col_amt = 1779.03,
|
60
|
-- updated_by = 'Support',
|
61
|
-- updated_date = GETDATE()
|
62
|
--WHERE col_id = '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
63
|
|
64
|
|
65
|
select * from txn_collection_approval_history where collection_id= '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
66
|
select * from txn_collection_approval_history_at where collection_id= '640c0de7-d21a-4f25-9bbb-e8791737e776' order by updated_date desc
|
67
|
-- update txn_collection_approval_history set status = 'Pending',
|
68
|
-- updated_by = 'Support',
|
69
|
-- updated_date = GETDATE()
|
70
|
--WHERE collection_id = '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
71
|
|
72
|
select * into DMS_Ecosystem_Backup_Table.dbo._txn_collection_approval_history_27062024
|
73
|
from DMS_EcoSystem.dbo.txn_collection_approval_history
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80
|
select * from txn_mobile_collection_invoice where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776'--ccmn1000003
|
81
|
select a.at_date,* from txn_mobile_collection_invoice_at a where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776' order by a.at_date desc--ccmn1000003
|
82
|
--UPDATE txn_mobile_collection_invoice
|
83
|
--SET New_balance = NULL,
|
84
|
-- previous_balance = NULL,
|
85
|
-- status = 'Pending',
|
86
|
-- updated_by = 'Support',
|
87
|
-- updated_date = GETDATE()
|
88
|
--WHERE col_id = '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
89
|
|
90
|
|
91
|
|
92
|
select a.updated_date,* from txn_mobile_collection_detail a where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776' order by a.updated_date desc
|
93
|
select a.at_date,* from txn_mobile_collection_detail_at a where col_id= '640c0de7-d21a-4f25-9bbb-e8791737e776' order by a.at_date desc
|
94
|
--UPDATE txn_mobile_collection_detail
|
95
|
--SET doc_amt = 38.61,
|
96
|
-- doc_unpaid = 38.61,
|
97
|
-- status = 'Pending',
|
98
|
-- updated_by = 'Support',
|
99
|
-- updated_date = GETDATE()
|
100
|
--WHERE col_id = '640c0de7-d21a-4f25-9bbb-e8791737e776'
|
101
|
-- AND col_dtl_id = 'ea0d9c5a88674767b0842e883cf7dd5b'
|
102
|
|
103
|
|
104
|
|
105
|
|
106
|
and col_dtl_id= '598b16e4-0cbd-45f0-888b-d65e013860ee'
|
107
|
SELECT TOP 1 *
|
108
|
FROM txn_mobile_collection_detail
|
109
|
WHERE doc_type = 'P/D Cheque'
|
110
|
and status='pending'
|
111
|
SELECT TOP 1 *
|
112
|
FROM txn_mobile_collection_header
|
113
|
WHERE col_id = '2e5e1515-6311-4519-b8e9-5794bd790e22'
|
114
|
|
115
|
select * from txn_invoice_history_header_at where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5' order by at_date desc
|
116
|
select * from txn_invoice_history_header where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'--ccmn1000003
|
117
|
--update txn_invoice_history_header set invoice_balance= 38.61 ,updated_by = 'Support', updated_date = getdate() where invoice_id= 'CD28C2F56FD043E580FD181E2B08C3C5'
|
118
|
|
119
|
select 38.61+38.61
|
120
|
select * from txn_credit_note_history_header where credit_note_no like '%CN24/003116%'
|
121
|
select * from txn_credit_note_history_header_at where credit_note_no like '%CN24/003116%' order by at_date desc
|
122
|
--update txn_credit_note_history_header set credit_note_balance= 38.61,updated_by = 'Support', updated_date = getdate() where credit_note_header_id = '106AD4996E00490D96C702A92906025F'
|
123
|
select * from txn_credit_note_history_detail where credit_note_id = '106AD4996E00490D96C702A92906025F'
|
124
|
|
125
|
-- change to credit_note_balance to 38.61
|
126
|
exec sp_executesql N'SELECT * FROM txn_collection_approval_history WHERE collection_id= @collection_id_573f2697669649e9896c51e4a91a2c72 AND org_id= @org_id_573f2697669649e9896c51e4a91a2c72 ',N'@collection_id_573f2697669649e9896c51e4a91a2c72 nvarchar(36),@org_id_573f2697669649e9896c51e4a91a2c72 nvarchar(6)',@collection_id_573f2697669649e9896c51e4a91a2c72=N'640c0de7-d21a-4f25-9bbb-e8791737e776',@org_id_573f2697669649e9896c51e4a91a2c72=N'SNEKKU'
|
127
|
exec sp_executesql N'select cd.col_dtl_id, cd.doc_no, cd.col_id, cd.doc_amt, cd.doc_date as doc_date, cd.doc_unpaid, cd.doc_amt as paid, cd.mobile_remark, cd.web_remark, cd.mobile_paid, cd.web_paid,cd.doc_type,cd.doc_amt,cd.bank,cd.journal_notation,cd.payment_narration,cd.temporary_receipt from txn_mobile_collection_detail cd left join txn_mobile_collection_header ch on ch.col_id = cd.col_id where cd.col_id = @col_id and cd.doc_type in (''Cash'', ''P/D Cheque'', ''Cheque'', ''Online Banking'') and cd.org_id = @org_id',N'@col_id nvarchar(36),@org_id nvarchar(6)',@col_id=N'640c0de7-d21a-4f25-9bbb-e8791737e776',@org_id=N'SNEKKU'
|
128
|
exec sp_executesql N'select cd.col_dtl_id, cd.doc_no, cd.col_id, cd.doc_amt, cd.doc_date as doc_date
|
129
|
,(case when ch.status Like ''%Pending%'' then cn.credit_note_balance + cd.web_paid else cn.credit_note_balance end) as doc_unpaid, cd.web_paid as paid, cd.mobile_remark, cd.web_remark, cd.mobile_paid, cd.web_paid,''0.00'' as TotalAmount
|
130
|
from txn_mobile_collection_detail cd
|
131
|
left join txn_mobile_collection_header ch on ch.col_id = cd.col_id
|
132
|
inner join txn_credit_note_history_header cn on cd.doc_no = cn.credit_note_no
|
133
|
where cd.col_id = @col_id and cd.doc_type = ''CN'' and cd.org_id = @org_id and cd.web_paid != ''0.00''
|
134
|
union
|
135
|
select cd.col_dtl_id, cd.doc_no, cd.col_id, cd.doc_amt, cd.doc_date as doc_date
|
136
|
,(case when ch.status Like ''%Pending%'' then cn.credit_note_balance + cd.web_paid else cn.credit_note_balance end) as doc_unpaid, cd.web_paid as paid, cd.mobile_remark,cd.web_remark, cd.mobile_paid, cd.web_paid,''0.00'' as TotalAmount
|
137
|
from txn_mobile_collection_detail cd
|
138
|
left join txn_mobile_collection_header ch on ch.col_id = cd.col_id
|
139
|
inner join txn_credit_note_non_product_header cn on cd.doc_no = cn.credit_note_no
|
140
|
where cd.col_id = @col_id and cd.doc_type = ''CN (Non-Product)'' and cd.org_id = @org_id and cd.web_paid != ''0.00''',N'@col_id nvarchar(36),@org_id nvarchar(6)',@col_id=N'640c0de7-d21a-4f25-9bbb-e8791737e776',@org_id=N'SNEKKU'-----------backup---------------------------------------------------------------------------------
|
141
|
|
142
|
-- select * into DMS_Ecosystem_Backup_Table.dbo.txn_credit_note_history_header_27062024
|
143
|
|
144
|
--from DMS_EcoSystem.dbo.txn_credit_note_history_header
|
145
|
|
146
|
|
147
|
-- select * into DMS_Ecosystem_Backup_Table.dbo._txn_invoice_history_header_27062024
|
148
|
|
149
|
--from DMS_EcoSystem.dbo.txn_invoice_history_header
|
150
|
|
151
|
|
152
|
-- select * into DMS_Ecosystem_Backup_Table.dbo._txn_mobile_collection_header_27062024_
|
153
|
|
154
|
--from DMS_EcoSystem.dbo.txn_mobile_collection_header
|
155
|
|
156
|
|
157
|
|
158
|
-- select * into DMS_Ecosystem_Backup_Table.dbo._txn_mobile_collection_detail_27062024
|
159
|
|
160
|
--from DMS_EcoSystem.dbo.txn_mobile_collection_detail
|
161
|
|
162
|
-- select * into DMS_Ecosystem_Backup_Table.dbo._txn_mobile_collection_invoice_27062024
|
163
|
--from DMS_EcoSystem.dbo.txn_mobile_collection_invoice
|
164
|
|
165
|
|
166
|
select 1817.64+38.61
|
167
|
|
168
|
|
169
|
|
170
|
remark, cd.web_remark, cd.mobile_paid, cd.web_paid,cd.doc_type,cd.doc_amt,cd.bank,cd.journal_notation,cd.payment_narration,cd.temporary_receipt from txn_mobile_collection_detail cd left join txn_mobile_collection_header ch on ch.col_id = cd.col_id where cd.col_id = @col_id and cd.doc_type in (''Cash'', ''P/D Cheque'', ''Cheque'', ''Online Banking'') and cd.org_id = @org_id',N'@col_id nvarchar(36),@org_id nvarchar(6)',@col_id=N'640c0de7-d21a-4f25-9bbb-e8791737e776',@org_id=N'SNEKKU'
|