private bool FillOutputsDocuments_dt()
        {
            bool bOK = true;

            dt = null;

            oOutputDocument.FillData();
            if (oOutputDocument.ErrorNumber != 0 || oOutputDocument.MainTable == null)
            {
                bOK = false;
            }

            if (bOK)
            {
                oOutputDocument.FillTTNTableOutputsDocuments("-1");
                if (oOutputDocument.ErrorNumber != 0 || !oOutputDocument.DS.Tables.Contains("TableOutputsDocumentsTTN"))
                {
                    bOK = false;
                }
            }
            if (bOK)
            {
                dt = CopyTable(oOutputDocument.DS.Tables["TableOutputsDocumentsTTN"], "dt", "", "");

                DataTable dtOutputsDocuments = CopyTable(oOutputDocument.MainTable, "dtOutputsDocuments", "",
                                                         "PartnerDetailBayerID, PartnerDetailShipperID, BillNumber");
                int    nPartnerDetailBayerID       = 0;
                int    nPartnerDetailShipperID     = 0;
                string sOutputsDocumentsIDTempList = "";
                foreach (DataRow r in dtOutputsDocuments.Rows)
                {
                    if (((int)r["PartnerDetailBayerID"] != nPartnerDetailBayerID ||
                         (int)r["PartnerDetailShipperID"] != nPartnerDetailShipperID) &&
                        sOutputsDocumentsIDTempList.Length > 0)
                    {
                        oOutputDocument.FillTTNTableOutputsDocuments(sOutputsDocumentsIDTempList);
                        if (oOutputDocument.ErrorNumber != 0 || !oOutputDocument.DS.Tables.Contains("TableOutputsDocumentsTTN"))
                        {
                            bOK = false;
                            break;
                        }

                        dt.Merge(oOutputDocument.DS.Tables["TableOutputsDocumentsTTN"]);
                        sOutputsDocumentsIDTempList = "";
                    }

                    sOutputsDocumentsIDTempList += r["ID"].ToString() + ",";
                    nPartnerDetailBayerID        = (int)r["PartnerDetailBayerID"];
                    nPartnerDetailShipperID      = (int)r["PartnerDetailShipperID"];
                }
                if (sOutputsDocumentsIDTempList.Length > 0)
                {
                    oOutputDocument.FillTTNTableOutputsDocuments(sOutputsDocumentsIDTempList);
                    if (oOutputDocument.ErrorNumber != 0 || !oOutputDocument.DS.Tables.Contains("TableOutputsDocumentsTTN"))
                    {
                        bOK = false;
                    }
                    else
                    {
                        dt.Merge(oOutputDocument.DS.Tables["TableOutputsDocumentsTTN"]);
                    }
                }
            }
            return(bOK);
        }