Our Community is over 1 Million Strong. Join Us.

Grand Future Air Dried Beef Dog Food
Air Dried Dog Food | Real Beef

Grain-Free, Zero Fillers


the four click thread.


Pages : [1] 2

taranaki
07-18-2004, 03:00 PM
Click 'post reply'.
Right click.
Click paste.
Click 'submit new post'



Get clicking. :evillol:


Katherine Hepburn.

SeXy_AnGeL
07-18-2004, 03:04 PM
http://img5.exs.cx/img5/1318/amaccord1.jpg

Hyatus
07-18-2004, 03:04 PM
???

DevoutWankelist
07-18-2004, 03:18 PM
http://www.rustypenny.com/cowburger.jpg
EVANSVILLE, Ind. -- Fear of mad cow disease hasn't kept customers from eating the deep-fried cow brain sandwiches at the Hilltop Inn in Evansville, Ind. The delicacy is traced back to a time when southern Indiana newcomers from Germany and Holland wasted little. Some families have their own recipes passed down over the generations

Karen512
07-18-2004, 03:22 PM
???

I'm confused also

DevoutWankelist
07-18-2004, 03:24 PM
???

Click 'post reply'.
Right click.
Click paste.
Click 'submit new post'



Get clicking.


(I couldn't resist)

dayna240sx
07-18-2004, 03:27 PM
[img]
EVANSVILLE, Ind. -- Fear of mad cow disease hasn't kept customers from eating the deep-fried cow brain sandwiches at the Hilltop Inn in Evansville, Ind. The delicacy is traced back to a time when southern Indiana newcomers from Germany and Holland wasted little. Some families have their own recipes passed down over the generations

Yeah, people in Evansville are pretty fucked up. I do all the insurance billing at work from our store in Evansville. About 75% of them are on welfare.

Hyatus
07-18-2004, 04:05 PM
http://files.automotiveforums.com/gallery/uploads/82015/up_down.jpg

Damien
07-18-2004, 04:08 PM
http://www.humandescent.com/

Hyatus
07-18-2004, 04:10 PM
http://files.automotiveforums.com/gallery/uploads/82015/38-fillerup.jpg

And yes it was a woman driving.

Not sure what this threads topic is so ill just post some pics....

dayna240sx
07-18-2004, 04:13 PM
Here, I'll simplify it for you guys...

Go to the quick message, press ctrl and "v" at the same time. then post...

Karen512
07-18-2004, 05:01 PM
http://instagiber.net/smiliesdotcom/contrib/edoom/spacecraft.gif

grimmy
07-18-2004, 05:12 PM
I admire you above all for your purity of spirit and your appreciation of the arts.
J'aimerais bien une petite gâterie, ma jolie.
Si quieres chuparme el pito, no voy a protestar.

korndogg
07-18-2004, 05:23 PM
78ndsgepbn

RSX-S777
07-18-2004, 05:31 PM
Click 'post reply'.
Right click.
Click paste.
Click 'submit new post'

Damien
07-18-2004, 05:36 PM
:nono: http://mindscraps.com/s/contrib/anym/hanged.gif

Quelle gaspillage des resources du Rézo.
¡Qué manera de despilfarrar los recursos de la Red!
Du verschwendest Übertragungskapazitäten.

Amish_kid
07-18-2004, 05:40 PM
Man, I've told you once and I'll tell you again, Condoms are for sailors just stick it in her butt.

:uhoh:

While talking to one of my friends. And then forwarding it to others.
:lol2:

FireBball972
07-18-2004, 06:05 PM
it doesn't work, i'm confused, and wtf is going on here???

Sean
07-18-2004, 06:10 PM
http://files.automotiveforums.com/vbulletin/images/reply.gif (http://www.automotiveforums.com/vbulletin/login.php?do=logout)

Damien
07-18-2004, 06:15 PM
Beat this!

http://files.automotiveforums.com/vbulletin/images/newthread.gif (http://www.automotiveforums.com/vbulletin/newthread.php?f=664)

Oz
07-18-2004, 06:17 PM
Shared Data on 'Eos-server'

Chavez408
07-18-2004, 06:22 PM
donne-moi une partie stp

-GS-
07-18-2004, 06:34 PM
http://members.lycos.co.uk/graphicserenity/index.html



(i was telling my friend to check out my site)

YellowMaranello
07-18-2004, 08:02 PM
There is an old saying among Ferrari owners: The difference between a German car and a Ferrari is like the difference between artificial insemination and mad, passionate lovemaking. Once you go Ferrari, all other automobiles are boring.

Jimster
07-18-2004, 08:35 PM
Dirty midget porn.






Wait, that wasn't me!!! :huh:

-Davo
07-18-2004, 09:06 PM
I'm aware that the extra 'holes' in the exhaust gives it about an extra 15-20hp :lol2: and the stickers add up to about..Hmm, damn! that's nearly 70hp! And that paint job! +120hp! Yeah, I can see wheres it's coming from! :lol2:


(that's what I had)

eversio11
07-19-2004, 12:52 AM
Chouette!

Damien
07-19-2004, 01:09 AM
meg.tr.cx

^ some site someone randomly IMed me. Haven't went to it so, if you venture, I warned you...

Toksin
07-19-2004, 01:25 AM
<dirty link someone sent to me that i passed on>

-Davo
07-19-2004, 01:47 AM
Post! Post! Post! Post! :d:d

Sean
07-19-2004, 01:53 AM
http://dickcream.com/history/0702/

GTA
07-19-2004, 02:27 AM
Dscf0018.jpg

tazdev
07-19-2004, 03:07 AM
:nono:

damir831
07-19-2004, 03:09 PM
50103

lamehonda
07-19-2004, 03:13 PM
http://www.viagra.com/swf/misc/mlbLogo.gif

Atomis27
07-19-2004, 03:29 PM
Insight_Working.Employment_Category

Suislide
07-19-2004, 03:41 PM
.















































(i have nothing currently stored in the "copy" thing, since i just turned my computer on about 5 minutes ago).

Raz_Kaz
07-19-2004, 03:52 PM
[QUOTE=Damien]:nono: http://mindscraps.com/s/contrib/anym/hanged.gif

Quelle gaspillage des resources du Rézo.QUOTE]
It's actually said more like this..."Quelle gaspiallge des ressources du reseau"...but whatever ;)

YogsVR4
07-19-2004, 03:52 PM
SET QUOTED_IDENTIFIER OFF
go
SET ANSI_NULLS ON
go
IF OBJECT_ID('dbo.appGenerateInvoiceCommitment') IS NOT NULL
BEGIN
DROP PROCEDURE dbo.appGenerateInvoiceCommitment
IF OBJECT_ID('dbo.appGenerateInvoiceCommitment') IS NOT NULL
PRINT '<<< FAILED DROPPING PROCEDURE dbo.appGenerateInvoiceCommitment >>>'
ELSE
PRINT '<<< DROPPED PROCEDURE dbo.appGenerateInvoiceCommitment >>>'
END
go

create procedure dbo.appGenerateInvoiceCommitment @HeaderPK int, @LoadKey varchar(50)
as
/*
Purpose: To create a commitment line items for an invoice.
Deterimine the adjustments that need to be done for each record in the working table for the parameters passed.
Unconfirm - Confirm
New commitment.
Confirm - Changes to amounts/description
Not batched - Alter the amounts on the commitment
Batch Created - Alter the amounts on the commitment
Batch Listed - Set batch status back to created and
Alter the amounts on the commitment
Batch Posted - Create offsetting adjustment
Confirmed - Unconfirm & Reject
Not batched - Mark row deleted
Batch Created - Rremove from batch and mark row deleted
Batch Listed - Remove from batch and mark row deleted and
set batch status back to created
Batch Posted - Create offsetting adjustment
After commitment has been processed, set the invoice line item to the
status (Unconfirmed or Rejected)
Rejected - Confirm
Create commitment if it doesn't exist. Other wise there are multiple
rejects/confirms, and the existing commimtents will be dealth with by
the following.
Not batched &
Batch Created - If there is a deleted commitment for this newly
confirmed commitment, its status will be set to open
to offset from deleted.
Batch Listed - If there is a deleted commitment for this newly
confirmed commitment, its status will be set to open
to offset from deleted and the batch status will be
set to 'created'.
Batch Posted - Create offsetting commitment
Rejected - Unconfirm
In this case, no commitment should exist to modify. Any prior
commitment would have been handled by the initial Reject.
Created : 2.23.04 dwg
Revisions: 3.03.04 dwg Now mark the invoice closed if there are no open line items.
3.22.04 dwg The invoice line item status changed from 'Commitment Generated' to 'Confirmed'
3.30.04 dwg Do not mark the invoice closed on commitment creation - that function is done at the time of posting
6.14.94 dwg @HeaderPK is now the apWorkingInvoiceHeader.pk value
*/
set nocount on
declare @PK int
declare @LocalTransaction int
declare @err int
declare @ret int
declare @tnSummaryTranPK int
declare @DiscountPercent decimal(19,4)
declare @LineNumber int
declare @Description varchar(50)
declare @TranDescription varchar(50)
declare @Quantity t_moneyDecimal
declare @PricePerUnit t_moneyDecimal
declare @ExtendedAmount t_moneyDecimal
declare @InternalPartNumber varchar(50)
declare @ExternalPartNumber varchar(50)
declare @osCompanyModulePK int
declare @osParticipantPK int
declare @HeaderTranType int
declare @PaymentGroup int
declare @tnTranType int
declare @HeaderOpenStatusPK int
declare @tnTranOpenStatusPK int
declare @WorkerPK int
declare @NewtnHeaderPK int
declare @tnTranStatusPK int
declare @DueDate datetime
declare @TransactionAmount t_moneyDecimal
declare @fkGLvalid int
declare @DistAmount t_moneyDecimal
declare @GLDistPK int
declare @HeaderDate datetime
declare @fkMLSosCodeDiscountMethod int
declare @Terms int
declare @LineItemtnHeaderPK int
declare @LineItemtnSummaryTranPK int
declare @LineItemtnTranPK int
declare @SummaryTranOriginalAmount t_moneydecimal
declare @IsOn1099 varchar(3)
declare @Note varchar(255)
declare @tnTranInvoiceWorking int
declare @APAccountPK int
declare @ExpenseAccountPK int
declare @InvoiceStatusPK int
declare @TNSTranDescription varchar(50)
declare @TNSLineNumber int
declare @TNSQuantity decimal(19,2)
declare @TNSExtendedAmount t_moneydecimal
declare @TNSIsOn1099 varchar(3)
declare @CurrentOpenStatus varchar(50)
declare @CurrentOpenStatusPK int
declare @CurrentPostStatus varchar(50)
declare @CurrentPostStatusPK int
declare @WorkingStatus varchar(12)
declare @TNSAmount t_moneydecimal
declare @NewPK int
declare @tnHeaderPK int
declare @tnTranPK int
declare @TNSAmountNew t_moneydecimal
declare @ChangeInGL varchar(3)
declare @UnitOfMeasure varchar(20)
declare @PurchaseOrderNumber varchar(15)
declare @tnSummaryTranPKInitial int
declare @ReductionAmount t_moneydecimal
declare @IncreaseAmount t_moneydecimal
declare @CommitmentOpenStatusPK int
declare @AmountChangeReason varchar(50)
declare @InitialInvoiceLineItemAmount t_moneydecimal
declare @DiscountDays int
declare @InvoicetnHeaderpk int
declare @apWorkingPK int
declare @SummaryTranPK int
declare @LINO int
declare @tnSummaryTranPKInvoice int
Declare @WorkingInvoiceStatus Table (pk int null,
Status varchar(20) null)
if @HeaderPK is null begin
raiserror('Unable to locate the invoice header. (appGenerateInvoiceCommitment)', 16, 1)
return 10001
end
set @osCompanyModulePK = (select pk
from oscompanymodule
where lkmlsosmodule = 12)
select
@osParticipantPK = apWorkingInvoiceHeader.fkosparticipantVendor,
@PaymentGroup = apWorkingInvoiceHeader.fkosparticipantpaymentgroup ,
@DueDate = apWorkingInvoiceHeader.InvoiceDueDate,
@Description = apWorkingInvoiceHeader.Description,
@HeaderDate = apWorkingInvoiceHeader.InvoiceDate,
@Terms = apWorkingInvoiceHeader.Terms,
@DiscountPercent = apWorkingInvoiceHeader.DiscountPercent,
@fkMLSosCodeDiscountMethod = apWorkingInvoiceHeader.fkMLSosCodeDiscountMethod,
@DiscountDays = apWorkingInvoiceHeader.DiscountDays
from apWorkingInvoiceHeader
where apWorkingInvoiceHeader.pk = @HeaderPK
exec ospGetCompanyWorkerByDBUserID @WorkerPK output
if @@TranCount = 0 begin
set @LocalTransaction = 1
begin transaction
end
-- 6.25.04 dwg
-- This temp table is used to track the value of the statuses for the working invoice line items
-- After the exec appCommitWorkingInvoice @HeaderPK is run, the status change will be lost and
-- further down the code, the original status is needed.
insert @WorkingInvoiceStatus(pk,status)
select fktnSummaryTran, Status
from apWorkingInvoiceLineItem
where fkapWorkingInvoiceHeader = @HeaderPK
-- 6.14.04 dwg
exec appCommitWorkingInvoice @HeaderPK
if @@Error <> 0 begin
set @err = @@Error
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create/edit invoice entries in appCommitWorkingInvoice. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

set @InvoicetnHeaderpk = (select fktnHeader
from apWorkingInvoiceHeader
where pk = @HeaderPK)
declare apWorkingItems_cursor insensitive cursor for
select fktnSummaryTran, linenumber
from apWorkingInvoiceLineItem
where fkapWorkingInvoiceHeader = @HeaderPK
open apWorkingItems_cursor
fetch next from apWorkingItems_cursor into @SummaryTranPK, @LINO
while @@fetch_status = 0 begin
update tnTranInvoiceWorking
set lktnSummarytran = @SummaryTranPK
where Linenumber = @LINO and
lkapWorkingInvoiceHeader = @HeaderPK
fetch next from apWorkingItems_cursor into @SummaryTranPK, @LINO
end
deallocate apWorkingItems_cursor
-- See if there is a commitment header for this invoice already.
-- if there is not, then create it.
if (select count(*) from tnHeader where tnHeader.lktnHeaderReference = @InvoicetnHeaderpk and tnHeader.fkMLStnHeaderType = 9) < 1 begin -- @HeaderPK
-- create the oscontrolnumberstatus records we will need for this the detail row
exec @ret = ospNextControlNumber 'tnHeader',
0,
'fkosControlNumberOpenStatus',
@osCompanyModulePK,
@HeaderOpenStatusPK output

-- create the PKs for the tables
exec @NewtnHeaderPK = ospNextPK 'tnHeader'
-- create the tnHeader row
insert into tnHeader (PK, lktnHeaderReference, fkosCompanyModule, fkosParticipant, fkMLStnHeaderType, Description,
fkosControlNumberOpenStatus, fkosParticipantPaymentGroup, fkoscompanyworkercreate, HeaderDate)
values (@NewtnHeaderPK, @InvoicetnHeaderpk, @osCompanyModulePK, @osParticipantPK, 9, @Description, --@HeaderPK
@HeaderOpenStatusPK, @PaymentGroup, @WorkerPK, @HeaderDate)
if @@Error <> 0 begin
set @err = @@Error
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create tnHeader row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
-- create the apheader row
insert into apHeader (fktnHeader, DueDate, fkMLSosCodeDiscountMethod, DiscountPercent, Terms, DiscountDays)
values (@NewtnHeaderPK, @DueDate, @fkMLSosCodeDiscountMethod, @DiscountPercent, @Terms, @DiscountDays )

if @@Error <> 0 begin
set @err = @@Error
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create apHeader row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
exec ospUpdateControlNumberStatusByPK @HeaderOpenStatusPK, 'Open', null, 'Yes'
end
else begin
set @NewtnHeaderPK = (select top 1 tnHeader.pk from tnHeader where tnHeader.lktnHeaderReference = @InvoicetnHeaderpk and tnHeader.fkMLStnHeaderType = 9) -- @HeaderPK
-- update the discount and terms
update tnHeader
set Description = @Description,
fkosParticipantPaymentGroup = @PaymentGroup
where pk = @NewtnHeaderPK
update apHeader
set DueDate = @DueDate,
fkMLSosCodeDiscountMethod = @fkMLSosCodeDiscountMethod,
DiscountPercent = @DiscountPercent,
Terms = @Terms,
DiscountDays = @DiscountDays
where fktnHeader = @NewtnHeaderPK
end
-- First build the new records
declare NewCommitments_cursor cursor for
select
tnTranInvoiceWorking.pk,
tnTranInvoiceWorking.lktnSummarytran,
tnTranInvoiceWorking.Linenumber,
tnTranInvoiceWorking.Description,
tnTranInvoiceWorking.Quantity,
tnTranInvoiceWorking.Amount,
tnTranInvoiceWorking.On1099,
tnTranInvoiceWorking.AmountChangeReason
from tnTranInvoiceWorking
where tnTranInvoiceWorking.lkapWorkingInvoiceHeader = @HeaderPK and
tnTranInvoiceWorking.LoadKey = @LoadKey
and tnTranInvoiceWorking.RowType = 'New'
open NewCommitments_cursor
fetch next from NewCommitments_cursor into @tnTranInvoiceWorking, @tnSummaryTranPK, @LineNumber, @TranDescription, @Quantity, @ExtendedAmount, @IsOn1099, @AmountChangeReason
while @@fetch_status = 0 begin
-- Check that the invoice line item has not been turned into a commitment line item already.
if (select count(*) from apInvoiceCommitmentLink
where fktnSummaryTranInvoice = @tnSummaryTranPK) = 0 begin
-- set the variables for the line item

select
@SummaryTranOriginalAmount = tnSummaryTran.OriginalAmount,
@PricePerUnit = apTran.PricePerUnit,
@InternalPartNumber = apTran.InternalPartNumber,
@ExternalPartNumber = apTran.ExternalPartNumber,
@Note = tnTran.Note,
@tnTranStatusPK = tnTran.fkosControlNumberStatus,
@InitialInvoiceLineItemAmount = tnTran.TranAmount
from tnSummaryTran
join tnTran on tnTran.pk = tnSummaryTran.lktnTranOriginal
join apTran on apTran.fktnTran = tnTran.pk
where
tnSummaryTran.pk = @tnSummaryTranPK
--set the transaction type to commitment
set @tnTranType = 14
------------------------------------
-- build the commitment line item --
------------------------------------
-- create the oscontrolnumberstatus records we will need for this the detail row
exec @ret = ospNextControlNumber 'tnHeader',
0,
'fkosControlNumberOpenStatus',
@osCompanyModulePK,
@HeaderOpenStatusPK output
exec @ret = ospNextControlNumber 'tnTran',
0,
'fkosControlNumberStatus',
@osCompanyModulePK,
@tnTranOpenStatusPK output

-- create the PKs for the tables
exec @LineItemtnHeaderPK = ospNextPK 'tnHeader'
exec @LineItemtnSummaryTranPK = ospNextPK 'tnSummaryTran'
exec @LineItemtnTranPK = ospNextPK 'tnTran'
-- create the tnHeader row
insert into tnHeader (PK, lktnHeaderReference, fkosCompanyModule, fkosParticipant, fkMLStnHeaderType, Description,
fkosControlNumberOpenStatus, fkosParticipantPaymentGroup, fkoscompanyworkercreate)
values (@LineItemtnHeaderPK, @NewtnHeaderPK, @osCompanyModulePK, @osParticipantPK, 6, @TranDescription,
@HeaderOpenStatusPK, @PaymentGroup, @WorkerPK)

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create tnHeader row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

-- create the apheader row
insert into apHeader (fktnHeader, DueDate)
values (@LineItemtnHeaderPK, @DueDate)

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create apHeader row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

-- create the tnSummarytran row
if @IsOn1099 is null set @IsOn1099 = 'Yes'
insert into tnSummaryTran (PK, fktnHeader, lktnTranOriginal, TransactionDate, OriginalAmount, CurrentBalance, IsOn1099)
values (@LineItemtnSummaryTranPK, @LineItemtnHeaderPK, null, getdate(), @SummaryTranOriginalAmount, @ExtendedAmount, @IsOn1099)

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create tnSummaryTran row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

-- create the tnTran row
insert into tnTran (PK, fkosCompanyModule, fkMLStnTranType, fkosParticipant, Description, TranDate, TranAmount,
fkosCompanyWorkerCreate, CreateDate, fkosParticipantPaymentGroup, fktnSummaryTran, fkosControlNumberStatus, Note)
values (@LineItemtnTranPK, @osCompanyModulePK, 14, @osParticipantPK, @TranDescription, cast(floor(cast(getdate() as float)) as datetime), @ExtendedAmount,
@WorkerPK, getdate(), @PaymentGroup, @LineItemtnSummaryTranPK, @tnTranOpenStatusPK, @Note)

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create tnTran row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

-- update the tnSummarytran.lktnTranOriginal column
update tnSummaryTran
set lktnTranOriginal = @LineItemtnTranPK
where pk = @LineItemtnSummaryTranPK

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update tnSummaryTran row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

-- create the apTran row
insert into apTran (fktnTran, LineNumber, InternalPartNumber, ExternalPartNumber, Quantity, PricePerUnit)
values (@LineItemtnTranPK, @LineNumber, @InternalPartNumber, @ExternalPartNumber, @Quantity, @PricePerUnit)

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update apTran row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

-- create link between invoice line item item and the new commitment
insert into apInvoiceCommitmentLink (fktnSummaryTranInvoice, fktnSummaryTranCommitment)
values (@tnSummaryTranPK, @LineItemtnSummaryTranPK)
if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create apInvoiceCommitmentLink row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
if @ExtendedAmount <> 0 begin
-- Generate the GL distribution
if @tnTranInvoiceWorking is null
exec appCreateGLDistForCommitmentLI @LineItemtnTranPK
else begin
-- get the GL from glDistTemplate for the item
declare GLDist_cursor cursor for
select glDistTemplate.fkglValid, glDistTemplate.DistAmount
from glDistTemplate
where fkostable = 'tnTranInvoiceWorking'
and tablepk = @tnTranInvoiceWorking

open GLDist_cursor

fetch next from GLDist_cursor into @fkglValid, @DistAmount

while @@fetch_status = 0 begin
exec @GLDistPK = ospNextPK 'glDist'
insert into GLDist (pk, fkglValid, DistAmount, fkosTable, TablePK)
values (@GLDistPK, @fkglValid, @DistAmount, 'tnTran', @LineItemtnTranPK)

if @@Error <> 0 begin
set @err = @@Error
deallocate GLDist_cursor
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create GLDist rows from the invoice working file. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

fetch next from GLDist_cursor into @fkglValid, @DistAmount
end

deallocate GLDist_cursor
end --
end -- the tranamount is greater then zero

-- update the controlnumbers with an 'Open' status
exec ospUpdateControlNumberStatusByPK @HeaderOpenStatusPK, 'Open', null, 'Yes'
exec ospUpdateControlNumberStatusByPK @tnTranOpenStatusPK, 'Open', null, 'Yes'

exec ospUpdateControlNumberStatusByPK @tnTranStatusPK, 'Confirmed', null, 'No'

-- check the calculations for the amount columns
update apHeader
set apHeader.TotalAmountDue = (select sum(tntran.TranAmount)
from tnTran
join tnSummaryTran on tnSummaryTran.pk = tnTran.fktnSummaryTran
join tnHeader on tnHeader.pk = tnSummaryTran.fktnHeader
where tnHeader.lktnHeaderReference = @NewtnHeaderPK)
where fktnHeader = @NewtnHeaderPK
if @AmountChangeReason is not null begin
exec @NewPK = ospNextPK 'tnTranEdit'
insert tnTranEdit (pk, fkosTable, TablePK, fkMLSosCodeActivity, ActivityDate, fkosCompanyWorker,
Note, PreviousValue, NewValue)
values (@NewPK, 'tnTran', @LineItemtnTranPK, 1563, getdate(), @WorkerPK,
'Change of amount from invoice line item',
cast(@SummaryTranOriginalAmount as varchar(12)), cast(@ExtendedAmount as varchar(12)))

if @@Error <> 0 begin
set @err = @@Error
deallocate NewCommitments_cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the change in amount. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
end -- if @AmountChangeReason is not null begin
end -- the commitment doesn't exist.
fetch next from NewCommitments_cursor into @tnTranInvoiceWorking, @tnSummaryTranPK, @LineNumber, @TranDescription, @Quantity, @ExtendedAmount, @IsOn1099, @AmountChangeReason
end -- while @@fetch_status = 0 begin (creating new commitment line items)
deallocate NewCommitments_cursor
-------------------------------------------------------
------------ create adjusting transactions ------------
-------------------------------------------------------
declare ExistingRow_Cursor cursor for
select
tnTranInvoiceWorking.pk,
tnTranInvoiceWorking.lktnSummarytran,
tnTranInvoiceWorking.Linenumber,
tnTranInvoiceWorking.Description,
tnTranInvoiceWorking.Quantity,
tnTranInvoiceWorking.Amount,
tnTranInvoiceWorking.On1099,
tnTranInvoiceWorking.Status
from tnTranInvoiceWorking
where tnTranInvoiceWorking.lkapWorkingInvoiceHeader = @HeaderPK and
tnTranInvoiceWorking.LoadKey = @LoadKey
and tnTranInvoiceWorking.RowType = 'Existing'
open ExistingRow_Cursor
fetch next from ExistingRow_Cursor into @tnTranInvoiceWorking, @tnSummaryTranPK, @LineNumber, @TranDescription, @Quantity,
@ExtendedAmount, @IsOn1099, @WorkingStatus
while @@fetch_status = 0 begin
-- get the transaction that was put into the working area
-- 6/25/04 dwg
-- the following select is used to get the values from the existing commitment. Because the working table now stores the
-- tnsummarytran.pk value of the invoice line item, the commitment line item needs to be looked up. All the code below references
-- the value stored in @tnSummaryTranPK so that value will be set in the next couple lines. The value @tnSummaryTranPKInvoice
-- is used to set the current open status a few selects down.
-- The open status is looked up from the temp table @WorkingInvoiceStatus instead of the invoices status. The processing now
-- updates the invoice prior to processing the commitment changes and the following needs to know the status of the items prior
-- to that update to know what update should occur.
set @tnSummaryTranPKInvoice = @tnSummaryTranPK
set @tnSummaryTranPK = (select top 1 fktnSummaryTranCommitment
from apInvoiceCommitmentLink
where fktnSummaryTranInvoice = @tnSummaryTranPK
order by fktnSummaryTranCommitment desc)
select
@TNSTranDescription = tnTran.Description,
@TNSLineNumber = apTran.LineNUmber,
@TNSQuantity = apTran.Quantity,
@TNSExtendedAmount = dbo.apfGetCommitmentBalance(tnHeader.pk),
@TNSAmount = tnTran.TranAmount,
@TNSIsOn1099 = tnSummaryTran.IsOn1099,
@PricePerUnit = apTran.PricePerUnit,
@InternalPartNumber = apTran.InternalPartNumber,
@ExternalPartNumber = apTran.ExternalPartNumber,
@UnitOfMeasure = apTran.UnitOfMeasure,
@PurchaseOrderNumber = apTran.PurchaseOrderNumber,
@Note = tnTran.Note,
@tnTranStatusPK = tnTran.fkosControlNumberStatus,
--@CurrentOpenStatus = OpenStatus.Status,
@CurrentOpenStatusPK = OpenStatus.pk, --tnTranInvoiceLineItem.fkoscontrolnumberstatus,
@CurrentPostStatus = isnull(PostStatus.Status,'NIL'),
@CurrentPostStatusPK = tnHeader.fkosControlNumberPostStatus,
@CommitmentOpenStatusPK = tnHeader.fkoscontrolnumberopenstatus,
@tnHeaderPK = tnHeader.pk,
@tnTranPK = tnTran.pk
from tnSummaryTran
join tnHeader on tnHeader.pk = tnSummaryTran.fktnHeader
join tnTran on tnTran.pk = tnSummaryTran.lktnTranOriginal
join apTran on apTran.fktnTran = tnTran.pk

left join apInvoiceCommitmentLink on apInvoiceCommitmentLink.fktnSummaryTranCommitment = tnSummaryTran.pk
left join tnSummaryTran tnSummaryTranInvoiceLineItem on tnSummaryTranInvoiceLineItem.pk = apInvoiceCommitmentLink.fktnSummaryTranInvoice

left join tnTran tnTranInvoiceLineItem on tnTranInvoiceLineItem.pk = tnSummaryTranInvoiceLineItem.lktnTranOriginal
left join osControlNumberStatus OpenStatus On tnTranInvoiceLineItem.fkosControlNumberStatus = OpenStatus.PK
--left join osControlNumberStatus OpenStatus On tnTran.fkosControlNumberStatus = OpenStatus.PK
join tnHeader tnHeaderInvoice on tnHeaderInvoice.pk = dbo.tnfInitialInvoiceLineItemHeader(@tnSummaryTran PK)
left join osControlNumberStatus PostStatus On tnHeader.fkosControlNumberPostStatus = PostStatus.PK -- tnHeaderInvoice
where tnSummaryTran.pk = @tnSummaryTranPK
-- locate the initial summary tran row
set @tnSummaryTranPKInitial = (select dbo.tnfInitialSummaryTranPK(@tnSummaryTranPK))
set @CurrentOpenStatus = (select Status from @WorkingInvoiceStatus where PK = @tnSummaryTranPKInvoice)
-- check for GL changes.
set @ChangeInGL = 'No'
/*
print '@TNSTranDescription = ' + ltrim(@TNSTranDescription)
print '@CurrentOpenStatus = ' + ltrim(@CurrentOpenStatus)
print '@WorkingStatus = ' + ltrim(@WorkingStatus)
print '@CurrentPostStatus = ' + ltrim(@CurrentPostStatus)
print '@tnSummaryTranPK = ' + ltrim(@tnSummaryTranPK)
print '@tnSummaryTranPKInitial = ' + ltrim(@tnSummaryTranPKInitial)
select *
from tnHeader
join tnSummaryTran on tnSummaryTran.fktnHeader = tnHeader.pk
where tnSummaryTran.pk = @tnSummaryTranPK
print '-----------------'
*/
-- see if the counts are different
if (select count(*) from glDistTemplate
where fkostable = 'tnTranInvoiceWorking' and tablepk = @tnTranInvoiceWorking) =
(select count(*) from glDist
where glDist.pk in (select glDist.pk
from glDist
join tnTran on tnTran.pk = glDist.TablePK
join tnSummaryTran on tnSummaryTran.lktnTranOriginal = tnTran.pk
where tnSummaryTran.pk = @tnSummaryTranPK
and glDist.fkosTable = 'tnTran')) begin
-- now look for changes to amounts or accounts
declare GLDistTemplate_cursor cursor for
select glDistTemplate.fkglValid, glDistTemplate.DistAmount
from glDistTemplate
where fkostable = 'tnTranInvoiceWorking'
and tablepk = @tnTranInvoiceWorking
open GLDistTemplate_cursor
fetch next from GLDistTemplate_cursor into @fkglValid, @DistAmount
while @@fetch_status = 0 begin
if (select count(*)
from glDist
where gldist.fkglvalid = @fkglValid
and glDist.distamount = @DistAmount
and glDist.pk in (select glDist.pk
from glDist
join tnTran on tnTran.pk = glDist.TablePK
join tnSummaryTran on tnSummaryTran.lktnTranOriginal = tnTran.pk
where tnSummaryTran.pk = @tnSummaryTranPK
and glDist.fkosTable = 'tnTran')) = 0 set @ChangeInGL = 'Yes'
fetch next from GLDistTemplate_cursor into @fkglValid, @DistAmount
end
deallocate GLDistTemplate_cursor
end
else set @ChangeInGL = 'Yes'
-- deterimine if there was a change
if (@TNSTranDescription <> @TranDescription) or
(@TNSQuantity <> @Quantity) or
(@TNSExtendedAmount <> @ExtendedAmount) or
(@TNSIsOn1099 <> @IsOn1099) or
(@ChangeInGL = 'Yes') begin
-- deterimine the existing state of the transaction
if (@CurrentOpenStatus = 'Confirmed') and
(@WorkingStatus = 'Confirm') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
/*
print '---------------------------------------------'
print 'Processing confirmed confirmed not posted'
print '@tnSummaryTranPK = ' + ltrim(@tnSummaryTranPK)
print '@tnSummaryTranPKInitial = ' + ltrim(@tnSummaryTranPKInitial)
print 'Header PK ' + ltrim(@tnHeaderPK)
print '@CurrentOpenStatus = ' + ltrim(@CurrentOpenStatus)
print '@WorkingStatus = ' + ltrim(@WorkingStatus)
print '@CurrentPostStatus = ' + ltrim(@CurrentPostStatus)
print 'Description = ' + ltrim(@TranDescription)
print 'Original amount = ' + ltrim(@TNSExtendedAmount)
print 'New Amount = ' + ltrim(@ExtendedAmount)
*/
-- the existing commitment has not been added to a batch. Make the changes from the working data and log it
if @TNSQuantity <> @Quantity begin
update apTran
set Quantity = @Quantity
where apTran.fkTnTran in
(select tnSummaryTran.lktnTranOriginal from tnSummaryTran where tnSummaryTran.pk = @tnSummaryTranPK)
exec @NewPK = ospNextPK 'tnTranEdit'
insert tnTranEdit (pk, fkosTable, TablePK, fkMLSosCodeActivity, ActivityDate, fkosCompanyWorker,
Note, PreviousValue, NewValue)
values (@NewPK, 'tnTran', @tnTranPK, 1561, getdate(), @WorkerPK,
'', cast(@TNSQuantity as varchar(12)), cast(@Quantity as varchar(12)))

if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the change in quantity. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
end -- if @TNSQuantity <> @Quantity begin
if @TNSExtendedAmount <> @ExtendedAmount begin
if @TNSExtendedAmount = @TNSAmount
set @TNSAmountNew = @ExtendedAmount
else begin
if @TNSAmount < 0
set @TNSAmountNew = @TNSAmount + @ExtendedAmount
else set @TNSAmountNew = @ExtendedAmount
end
update tnTran
set TranAmount = @TNSAmountNew
where tnTran.pk in
(select tnSummaryTran.lktnTranOriginal from tnSummaryTran where tnSummaryTran.pk = @tnSummaryTranPK)
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update tnTran for the change in amount. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
exec @NewPK = ospNextPK 'tnTranEdit'

insert tnTranEdit (pk, fkosTable, TablePK, fkMLSosCodeActivity, ActivityDate, fkosCompanyWorker,
Note, PreviousValue, NewValue)
values (@NewPK, 'tnTran', @tnTranPK, 1563, getdate(), @WorkerPK,
'', cast(@TNSAmount as varchar(12)), cast(@TNSAmountNew as varchar(12)))
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the change in amount. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
end
if @TNSTranDescription <> @TranDescription
update tnTran
set Description = @TranDescription
where tnTran.pk in
(select tnSummaryTran.lktnTranOriginal from tnSummaryTran where tnSummaryTran.pk = @tnSummaryTranPK)
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the change of the description. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
if @TNSIsOn1099 <> @IsOn1099
update tnSummaryTran
set IsOn1099 = @IsOn1099
where tnSummaryTran.pk = @tnSummaryTranPK
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the change of 1099. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
if @ChangeInGL = 'Yes' begin
-- delete the GLDist rows and recreate them
delete glDist
where pk in (select glDist.pk
from glDist
join tnTran on tnTran.pk = glDist.TablePK
join tnSummaryTran on tnSummaryTran.lktnTranOriginal = tnTran.pk
where tnSummaryTran.pk = @tnSummaryTranPK
and glDist.fkosTable = 'tnTran')

if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not remove GLDist rows. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
-- if the amount is equal to zero. Do not right any records
if @ExtendedAmount <> 0 begin
declare GLDist_cursor cursor for
select glDistTemplate.fkglValid, glDistTemplate.DistAmount
from glDistTemplate
where fkostable = 'tnTranInvoiceWorking'
and tablepk = @tnTranInvoiceWorking

open GLDist_cursor

fetch next from GLDist_cursor into @fkglValid, @DistAmount

while @@fetch_status = 0 begin
exec @GLDistPK = ospNextPK 'glDist'
insert into GLDist (pk, fkglValid, DistAmount, fkosTable, TablePK)
values (@GLDistPK, @fkglValid, @DistAmount, 'tnTran', @tnTranPK)

if @@Error <> 0 begin
set @err = @@Error
deallocate GLDist_cursor
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create GLDist rows from the invoice working file. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
fetch next from GLDist_cursor into @fkglValid, @DistAmount
end
deallocate GLDist_cursor
end -- if @ExtendedAmount <> 0 begin

end -- if @ChangeInGL = 'Yes' begin
if @CurrentPostStatus = 'Listed'
exec ospUpdateControlNumberStatusByPK @CurrentPostStatusPK, 'Started', null, 'No'
end -- if (@CurrentOpenStatus = 'Confirmed') and
-- (@WorkingStatus = 'Confirmed') and
-- ( (@CurrentPostStatus = 'NIL') or
-- (@CurrentPostStatus = 'Started') or
-- (@CurrentPostStatus = 'Listed') ) begin
-- now deal with a posted row
if (@CurrentOpenStatus = 'Confirmed') and
(@WorkingStatus = 'Confirm') and
(@CurrentPostStatus = 'Posted') begin
-- deterimine the reduction/increase amounts
if (@TNSExtendedAmount > 0) and (@ExtendedAmount > 0) begin
set @ReductionAmount = @TNSAmount
set @IncreaseAmount = @ExtendedAmount
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, 'tnTranInvoiceWorking', @tnTranInvoiceWorking
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
else if (@TNSExtendedAmount > 0) and (@ExtendedAmount = 0) begin
set @ReductionAmount = @TNSAmount
set @IncreaseAmount = 0
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, null, null
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
else if (@TNSExtendedAmount > 0) and (@ExtendedAmount < 0) begin
-- in this condition we need to reduce the current amount and then do another reduction afterwards
set @ReductionAmount = @TNSAmount
set @IncreaseAmount = 0
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, null, null
set @ReductionAmount = @ExtendedAmount
set @IncreaseAmount = 0
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, 'tnTranInvoiceWorking', @tnTranInvoiceWorking
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
else if (@TNSExtendedAmount = 0) and (@ExtendedAmount > 0) begin
set @ReductionAmount = 0
set @IncreaseAmount = @ExtendedAmount
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, 'tnTranInvoiceWorking', @tnTranInvoiceWorking
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
else if (@TNSExtendedAmount = 0) and (@ExtendedAmount < 0) begin
set @ReductionAmount = @ExtendedAmount
set @IncreaseAmount = 0
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, 'tnTranInvoiceWorking', @tnTranInvoiceWorking, null, null
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end

-- negative commitments
else if (@TNSExtendedAmount < 0) and (@ExtendedAmount = 0) begin
set @ReductionAmount = 0
set @IncreaseAmount = @TNSAmount
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, null, null
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
else if (@TNSExtendedAmount < 0) and (@ExtendedAmount > 0) begin
set @ReductionAmount = @TNSAmount
set @IncreaseAmount = @ExtendedAmount
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, 'tnTranInvoiceWorking', @tnTranInvoiceWorking
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
else if (@TNSExtendedAmount < 0) and (@ExtendedAmount < 0) begin
set @ReductionAmount = @ExtendedAmount
set @IncreaseAmount = @TNSAmount
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, 'tnTranInvoiceWorking', @tnTranInvoiceWorking, null, null
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
end
end -- there was a change to the existing row
/* Confirmed - Unconfirm & Reject
Not batched - Mark row deleted
Batch Started - Remove from batch and mark row deleted
Batch Listed - Remove from batch and mark row deleted and
set batch status back to created
Batch Posted - Create offsetting adjustment */
if (@CurrentOpenStatus = 'Confirmed') and
(@WorkingStatus = 'Reject') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Deleted', null, 'No'
update apTran
set isToPay = 'No',
isNotToPay = 'Yes'
where fktnTran = @tnTranPK
exec @NewPK = ospNextPK 'tnTranEdit'

insert tnTranEdit (pk, fkosTable, TablePK, fkMLSosCodeActivity, ActivityDate, fkosCompanyWorker,
Note, PreviousValue, NewValue)
values (@NewPK, 'tnTran', @tnTranPK, 1560, getdate(), @WorkerPK,
'Rejected invoice line item', '', '')
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the rejected detail item. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
update tnHeader
set fkosControlNumberPostStatus = null
where pk = @tnHeaderPK
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update tnHeader post status for the rejected row. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Rejected', null, 'No'
if @CurrentPostStatus = 'Started'
exec ospUpdateControlNumberStatusByPK @CurrentPostStatusPK, 'Started', null, 'No'
end
if (@CurrentOpenStatus = 'Confirmed') and
(@WorkingStatus = 'Reject') and
(@CurrentPostStatus = 'Posted') begin
-- Create an adjustment to take the amounts to zero.
if @TNSExtendedAmount > 0 begin
set @ReductionAmount = @TNSExtendedAmount
set @IncreaseAmount = 0
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, null, null
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end

if @TNSExtendedAmount < 0 begin
set @ReductionAmount = 0
set @IncreaseAmount = @TNSExtendedAmount
exec appAdjustCommitment @ReductionAmount, @IncreaseAmount, @tnSummaryTranPKInitial, @tnSummaryTranPK, @TranDescription,
@Quantity, @UnitOfMeasure, @PricePerUnit, @InternalPartNumber, @ExternalPartNumber,
@PurchaseOrderNumber, null, null, null, null
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
return @err
end
end
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Rejected', null, 'No'
end
if (@CurrentOpenStatus = 'Rejected') and
(@WorkingStatus = 'Confirm') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
-- remove the deleted status from the commitment line item
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Open', null, 'No'
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Confirmed', null, 'No'
end
if (@CurrentOpenStatus = 'Rejected') and
(@WorkingStatus = 'Unconfirm') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
-- remove the deleted status from the commitment line item
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Unconfirmed', null, 'No'
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Unconfirmed', null, 'No'
if @CurrentPostStatus = 'Listed'
exec ospUpdateControlNumberStatusByPK @CurrentPostStatusPK, 'Started', null, 'No'
end
if (@CurrentOpenStatus = 'Rejected') and
(@WorkingStatus = 'Unconfirm') and
(@CurrentPostStatus = 'Posted') begin
-- remove the deleted status from the commitment line item
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Open', null, 'No'
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Confirmed', null, 'No'
end
-- process rows that are being unconfirmed
if (@CurrentOpenStatus = 'Confirmed') and
(@WorkingStatus = 'Unconfirm') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
print 'unconfirm a confirmed commitment'
print '@CommitmentOpenStatusPK = ' + ltrim(@CommitmentOpenStatusPK)
-- remove the deleted status from the commitment line item
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Unconfirmed', null, 'No'
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Unconfirmed', null, 'No'
if @CurrentPostStatus = 'Listed'
exec ospUpdateControlNumberStatusByPK @CurrentPostStatusPK, 'Started', null, 'No'
update tnHeader
set fkoscontrolnumberpoststatus = null
where tnHeader.pk in (select tnSummaryTran.fktnHeader from tnSummarytran where pk = @tnSummaryTranPK)
end
-- process rows that are being unconfirmed
if (@CurrentOpenStatus = 'Unconfirmed') and
(@WorkingStatus = 'Reject') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
-- remove the deleted status from the commitment line item
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Deleted', null, 'No'
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Rejected', null, 'No'
if @CurrentPostStatus = 'Listed'
exec ospUpdateControlNumberStatusByPK @CurrentPostStatusPK, 'Started', null, 'No'
update tnHeader
set fkoscontrolnumberpoststatus = null
where tnHeader.pk in (select tnSummaryTran.fktnHeader from tnSummarytran where pk = @tnSummaryTranPK)
end
-- process rows that are being unconfirmed
if (@CurrentOpenStatus = 'Unconfirmed') and
(@WorkingStatus = 'Confirm') and
( (@CurrentPostStatus = 'NIL') or
(@CurrentPostStatus = 'Started') or
(@CurrentPostStatus = 'Listed') ) begin
-- update the amounts if needed.
if @TNSExtendedAmount <> @ExtendedAmount begin
if @TNSExtendedAmount = @TNSAmount
set @TNSAmountNew = @ExtendedAmount
else begin
if @TNSAmount < 0
set @TNSAmountNew = @TNSAmount + @ExtendedAmount
else set @TNSAmountNew = @ExtendedAmount
end
update tnTran
set TranAmount = @TNSAmountNew
where tnTran.pk in
(select tnSummaryTran.lktnTranOriginal from tnSummaryTran where tnSummaryTran.pk = @tnSummaryTranPK)
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update tnTran for the change in amount. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end

exec @NewPK = ospNextPK 'tnTranEdit'

insert tnTranEdit (pk, fkosTable, TablePK, fkMLSosCodeActivity, ActivityDate, fkosCompanyWorker,
Note, PreviousValue, NewValue)
values (@NewPK, 'tnTran', @tnTranPK, 1563, getdate(), @WorkerPK,
'', cast(@TNSAmount as varchar(12)), cast(@TNSAmountNew as varchar(12)))
if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not update create tnTranEdit rows for the change in amount. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
end -- if @TNSExtendedAmount <> @ExtendedAmount begin
if @ChangeInGL = 'Yes' begin
-- delete the GLDist rows and recreate them
delete glDist
where pk in (select glDist.pk
from glDist
join tnTran on tnTran.pk = glDist.TablePK
join tnSummaryTran on tnSummaryTran.lktnTranOriginal = tnTran.pk
where tnSummaryTran.pk = @tnSummaryTranPK
and glDist.fkosTable = 'tnTran')

if @@Error <> 0 begin
set @err = @@Error
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not remove GLDist rows. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
-- if the amount is equal to zero. Do not right any records
if @ExtendedAmount <> 0 begin
declare GLDist_cursor cursor for
select glDistTemplate.fkglValid, glDistTemplate.DistAmount
from glDistTemplate
where fkostable = 'tnTranInvoiceWorking'
and tablepk = @tnTranInvoiceWorking

open GLDist_cursor

fetch next from GLDist_cursor into @fkglValid, @DistAmount

while @@fetch_status = 0 begin
exec @GLDistPK = ospNextPK 'glDist'
insert into GLDist (pk, fkglValid, DistAmount, fkosTable, TablePK)
values (@GLDistPK, @fkglValid, @DistAmount, 'tnTran', @tnTranPK)

if @@Error <> 0 begin
set @err = @@Error
deallocate GLDist_cursor
deallocate ExistingRow_Cursor
if @LocalTransaction = 1 rollback transaction
raiserror('Could not create GLDist rows from the invoice working file. (appGenerateInvoiceCommitment)', 16, 1)
return @err
end
fetch next from GLDist_cursor into @fkglValid, @DistAmount
end
deallocate GLDist_cursor
end -- if @ChangeInGL = 'Yes' begin
end -- if @ChangeInGL = 'Yes' begin
-- remove the deleted status from the commitment line item
exec ospUpdateControlNumberStatusByPK @CommitmentOpenStatusPK, 'Open', null, 'No'
exec ospUpdateControlNumberStatusByPK @CurrentOpenStatusPK, 'Confirmed', null, 'No'
if @CurrentPostStatus = 'Listed'
exec ospUpdateControlNumberStatusByPK @CurrentPostStatusPK, 'Started', null, 'No'
end
fetch next from ExistingRow_Cursor into @tnTranInvoiceWorking, @tnSummaryTranPK, @LineNumber, @TranDescription, @Quantity,
@ExtendedAmount, @IsOn1099, @WorkingStatus
end -- while @@fetch_status = 0 begin (ExistingRow_Cursor)
deallocate ExistingRow_Cursor
if (@LineItemtnSummaryTranPK > 0) or
(@tnSummaryTranPK > 0)
exec tnpCommitmentBalance @tnSummaryTranPK
if @LocalTransaction = 1
commit transaction
/*
print 'commitment header'
select pk, description, fkosControlNumberOpenStatus from tnHeader
where pk = @NewtnHeaderPK
print 'commitment detail'
select pk, description, fkosControlNumberOpenStatus from tnHeader
where lktnheaderreference = @NewtnHeaderPK
*/
return
go
IF OBJECT_ID('dbo.appGenerateInvoiceCommitment') IS NOT NULL
PRINT '<<< CREATED PROCEDURE dbo.appGenerateInvoiceCommitment >>>'
ELSE
PRINT '<<< FAILED CREATING PROCEDURE dbo.appGenerateInvoiceCommitment >>>'
go
SET ANSI_NULLS ON
go
SET QUOTED_IDENTIFIER OFF
go

Raz_Kaz
07-19-2004, 03:56 PM
:eek2: Calm down there Yogs...

Atomis27
07-19-2004, 04:07 PM
Yow! What language is that Yogs?

Raz_Kaz
07-19-2004, 04:17 PM
Yow! What language is that Yogs?
I belive it's programming :dunno:

Sean
07-19-2004, 04:31 PM
...

HOLY OPENSOURCE BATMAN

Shortbus
07-19-2004, 04:55 PM
1N6ED26TQ2C312616

^Vin for 96 Maxima yeah I was actually working at some point today...

flsurf420
07-19-2004, 11:26 PM
well i kno but i will probably mostly use my eyes for them because around here you can see them up ahead. and thanks high rev, i never thought of that. i just would like to have one, like you all said to get less. but some how my friends drive 100 mph+ on I-95 and the turnpike for like 10 min and never get caught.

Karen512
07-19-2004, 11:34 PM
http://www.autotrader.com/fyc/vdp.jsp?car_id=166680791&dealer_id=54730038&car_year=1990&make=NISSAN&distance=75&max_price=&model=300ZXTURBO&advcd_on=n&end_year=1996&min_price=&first_record=26&certified=n&address=76132&search_type=used&advanced=n&start_year=1984&=&color=&cardist=19

taranaki
07-20-2004, 12:52 AM
Yow! What language is that Yogs?

I think he just reprogrammed his microwave into a death ray.

Anyway........


http://www.fortunecity.com/meltingpot/dalston/714/quest.wav

iranintoavan
07-20-2004, 01:12 AM
Yeah, I like skinny dipping alot, have you ever gone? Its real fun and is really comfortable and relaxing and freeing.

LOL thats what was in my clipboard.

psychobadboy
07-20-2004, 02:34 AM
http://www.subaru.co.jp/impreza/wrlimited/index.html

Toksin
07-20-2004, 05:31 AM
One afternoon during a break in filming, Schwarzenegger went into a restaurant in downtown L.A. to get some lunch and realized all too late that he was still in Terminator makeup - with a missing eye, exposed jawbone and burned flesh.

taranaki
07-20-2004, 05:48 AM
even

blindside.AMG
07-20-2004, 05:53 AM
http://img.villagephotos.com/p/2004-5/735982/slr.jpg

Moppie
07-20-2004, 05:53 AM
Penrose, Auckland

Oz
07-20-2004, 07:15 AM
Private Messages Inbox
My God you were good last night. Please call me in the morning.

taranaki
07-20-2004, 07:20 AM
http://www.fat-pie.com/salad.htm

YogsVR4
07-20-2004, 09:25 AM
Yow! What language is that Yogs?

Just some SQL that I had pasted into query analyzer. The formatting goes to hell when pasted into here though.

Mediocrity
07-20-2004, 09:33 AM
If I were you - I'd talk with your sifu about doing sparring. Even if he is nervous for his students saftey, you can all chip in for some community gear and do continuous point sparring.

That in itself is better than doing choreographed fistsets IMO.

After doing that for a while, you can always get a set of the face-cage head gear and go to town.

Just my suggestion.

(was copying to paste so I could quote them on bullshido)

lostprophets
07-20-2004, 11:17 AM
ch-ch-ch-check it out

(beastie boys)

lamehonda
07-20-2004, 11:50 AM
The hospital building and some of the equipment is owned by the county. The rest of the equipment and employees are owned and managed by Banner Health Services, which is operated out of Arizona.

Damien
07-20-2004, 07:30 PM
sq38097474

Add your comment to this topic!


Quality Real Meat Nutrition for Dogs: Best Air Dried Dog Food | Real Beef Dog Food | Best Beef Dog Food