/*******************************************************************************************************/
        #region DATABASE METHODS
        #endregion DATABASE METHODS
        /*******************************************************************************************************/
        #region DATABASE STATIC METHODS

        public static Guid add(DateTime Timestamp, Guid Vendors_Id, string Notes, Dictionary <Guid, decimal> paymentData)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "VendorInvoicePayments_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, Util.getAsStartDate(Timestamp)),
                new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Vendors_Id)),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.NVarChar, Util.wrapNullable(Notes))
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submit(Id, "Created");
                VendorInvoicePaymentItem.add(Id, paymentData);
            }

            return(Id);
        }
示例#2
0
        public static Guid?add(string name)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "state_new",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_NAME, SqlDbType.VarChar, name)
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
示例#3
0
        public static void update(Guid Id, decimal debtLimit, int termDays, string notes)
        {
            CustomerTerm objOld = new CustomerTerm(Id);

            //generate log description
            string logDescription = "";

            if (objOld.DebtLimit != debtLimit)
            {
                logDescription = Tools.append(logDescription, String.Format("Limit: '{0}' to '{1}'", objOld.DebtLimit, debtLimit), ",");
            }
            if (objOld.TermDays != termDays)
            {
                logDescription = Tools.append(logDescription, String.Format("Term days: '{0}' to '{1}'", objOld.TermDays, termDays), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "CustomerTerms_update",
                    new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                    new SqlQueryParameter(COL_DB_DEBTLIMIT, SqlDbType.Decimal, debtLimit),
                    new SqlQueryParameter(COL_DB_TERMDAYS, SqlDbType.Int, termDays),
                    new SqlQueryParameter(COL_DB_NOTES, SqlDbType.NVarChar, Util.wrapNullable(notes))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submitUpdate(Id, logDescription);
                }
            }
        }
示例#4
0
        public static void update_FakturPajaks_Id(Guid Id, Guid?FakturPajaks_Id)
        {
            SaleReturn objOld = new SaleReturn(Id);
            string     log    = "";

            log = ActivityLog.appendChange(log, objOld.FakturPajaks_No, new FakturPajak(FakturPajaks_Id).No, "Faktur Pajak: '{0}' to '{1}'");

            if (string.IsNullOrEmpty(log))
            {
                Util.displayMessageBoxError("No changes to record");
            }
            else
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "salereturn_update_FakturPajaks_Id",
                    new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, Id),
                    new SqlQueryParameter(COL_DB_FakturPajaks_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(FakturPajaks_Id))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submit(Id, String.Format("Updated: {0}", log));

                    //update faktur pajak log
                    if (FakturPajaks_Id == null)
                    {
                        ActivityLog.submit((Guid)objOld.FakturPajaks_Id, String.Format("Removed Sale Return: {0}", objOld.barcode));
                    }
                    else
                    {
                        ActivityLog.submit((Guid)FakturPajaks_Id, String.Format("Added Sale Return: {0}", objOld.barcode));
                    }
                }
            }
        }
        public static Guid?add(string name, string notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "PettyCashRecordsCategories_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Name, SqlDbType.VarChar, Util.wrapNullable(name)),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
示例#6
0
        public static Guid?add(string invoiceNo, Guid Vendors_Id)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "VendorInvoices_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_InvoiceNo, SqlDbType.VarChar, invoiceNo),
                new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Vendors_Id)
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
示例#7
0
        public static Guid?add(string description, Guid?customerID, Guid?vendorID)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "todo_add",
                new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_DESCRIPTION, SqlDbType.VarChar, description),
                new SqlQueryParameter(COL_DB_CUSTOMERID, SqlDbType.UniqueIdentifier, Util.wrapNullable(customerID)),
                new SqlQueryParameter(COL_DB_VENDORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(vendorID))
                );

            if (!result.IsSuccessful)
            {
                return(null);
            }
            else
            {
                ActivityLog.submitCreate(Id);
                return(Id);
            }
        }
示例#8
0
        /*******************************************************************************************************/
        #region DATABASE METHODS

        public static Guid add(DateTime Timestamp, Guid Customers_Id, string No, decimal Amount, DateTime?ReturnDate, string Notes)
        {
            Guid           Id     = Guid.NewGuid();
            SqlQueryResult result = DBConnection.query(
                false,
                DBConnection.ActiveSqlConnection,
                QueryTypes.ExecuteNonQuery,
                "Kontrabons_add",
                new SqlQueryParameter(COL_DB_Id, SqlDbType.UniqueIdentifier, Id),
                new SqlQueryParameter(COL_DB_Timestamp, SqlDbType.DateTime, Util.getAsStartDate(Timestamp)),
                new SqlQueryParameter(COL_DB_Customers_Id, SqlDbType.UniqueIdentifier, Customers_Id),
                new SqlQueryParameter(COL_DB_No, SqlDbType.VarChar, No),
                new SqlQueryParameter(COL_DB_Amount, SqlDbType.Decimal, Amount),
                new SqlQueryParameter(COL_DB_ReturnDate, SqlDbType.DateTime, Util.wrapNullable(Util.getAsStartDate(ReturnDate))),
                new SqlQueryParameter(COL_DB_Notes, SqlDbType.NVarChar, Util.wrapNullable(Notes))
                );

            if (result.IsSuccessful)
            {
                ActivityLog.submitCreate(Id);
            }

            return(Id);
        }
示例#9
0
        /*******************************************************************************************************/

        #region DATABASE METHODS

        public static void submitItems(List <SaleItem> SaleItems, string SaleBarcode, Guid?Customers_Id)
        {
            foreach (SaleItem item in SaleItems)
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "saleitem_new",
                    new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, item.id),
                    new SqlQueryParameter(COL_DB_sale_id, SqlDbType.UniqueIdentifier, item.sale_id),
                    new SqlQueryParameter(COL_INVENTORY_ITEM_ID, SqlDbType.UniqueIdentifier, item.inventory_item_id),
                    new SqlQueryParameter(COL_SELLPRICE, SqlDbType.Decimal, item.sell_price),
                    new SqlQueryParameter(COL_ADJUSTMENT, SqlDbType.Decimal, item.adjustment),
                    new SqlQueryParameter(COL_DB_isManualAdjustment, SqlDbType.Bit, item.isManualAdjustment),
                    new SqlQueryParameter(COL_CUSTOMERID, SqlDbType.UniqueIdentifier, Util.wrapNullable(Customers_Id))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submit(item.inventory_item_id, "Sale ID: " + SaleBarcode);
                }
            }
        }
示例#10
0
        public static void add(Guid gordenOrderID, int lineNo, string description, decimal sellAmountPerUnit, int qty, string notes)
        {
            try
            {
                using (SqlCommand cmd = new SqlCommand("gordenorderitem_add", DBConnection.ActiveSqlConnection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    Guid id = Guid.NewGuid();
                    cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value            = id;
                    cmd.Parameters.Add("@" + COL_DB_GORDENORDERID, SqlDbType.UniqueIdentifier).Value = gordenOrderID;
                    cmd.Parameters.Add("@" + COL_DB_LINENO, SqlDbType.TinyInt).Value            = lineNo;
                    cmd.Parameters.Add("@" + COL_DB_DESCRIPTION, SqlDbType.VarChar).Value       = description;
                    cmd.Parameters.Add("@" + COL_DB_SELLAMOUNTPERUNIT, SqlDbType.Decimal).Value = sellAmountPerUnit;
                    cmd.Parameters.Add("@" + COL_DB_QTY, SqlDbType.Int).Value       = qty;
                    cmd.Parameters.Add("@" + COL_DB_NOTES, SqlDbType.VarChar).Value = Util.wrapNullable(notes);

                    cmd.ExecuteNonQuery();

                    ActivityLog.submit(id, "Item added");
                }
            }
            catch (Exception ex) { Tools.showError(ex.Message); }
        }
示例#11
0
        public static void update(Guid id, Guid gradeID, Guid productID, Guid productWidthID, Guid lengthUnitID, Guid colorID, int qty, int orderLotQty, string poNotes, string notes)
        {
            InventoryStockLevel objOld = new InventoryStockLevel(id);

            //generate log description
            string  logDescription = "";
            Product product        = new Product(productID);

            if (objOld.ProductStoreNameID != product.StoreNameID)
            {
                logDescription = Tools.append(logDescription, String.Format("Product Store Name: '{0}' to '{1}'", objOld.ProductStoreName, product.StoreName), ",");
            }
            if (objOld.GradeID != gradeID)
            {
                logDescription = Tools.append(logDescription, String.Format("Grade: '{0}' to '{1}'", objOld.GradeID, new Grade(gradeID).Name), ",");
            }
            if (objOld.ProductWidthID != productWidthID)
            {
                logDescription = Tools.append(logDescription, String.Format("Product Width: '{0}' to '{1}'", objOld.ProductWidthName, new ProductWidth(productWidthID).Name), ",");
            }
            if (objOld.LengthUnitID != lengthUnitID)
            {
                logDescription = Tools.append(logDescription, String.Format("Length Unit: '{0}' to '{1}'", objOld.LengthUnitID, new LengthUnit(lengthUnitID).Name), ",");
            }
            if (objOld.VendorName != product.VendorName)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor: '{0}' to '{1}'", objOld.VendorName, product.VendorName), ",");
            }
            if (objOld.OrderLotQty != orderLotQty)
            {
                logDescription = Tools.append(logDescription, String.Format("Lot qty: '{0}' to '{1}'", objOld.OrderLotQty, orderLotQty), ",");
            }
            if (objOld.Qty != qty)
            {
                logDescription = Tools.append(logDescription, String.Format("Qty: '{0}' to '{1}'", objOld.Qty, qty), ",");
            }
            if (objOld.PONotes != poNotes)
            {
                logDescription = Tools.append(logDescription, String.Format("PO Notes: '{0}' to '{1}'", objOld.PONotes, poNotes), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "inventorystocklevel_update",
                    new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id),
                    new SqlQueryParameter(COL_DB_GRADEID, SqlDbType.UniqueIdentifier, gradeID),
                    new SqlQueryParameter(COL_DB_PRODUCTID, SqlDbType.UniqueIdentifier, productID),
                    new SqlQueryParameter(COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier, productWidthID),
                    new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, lengthUnitID),
                    new SqlQueryParameter(COL_DB_COLORID, SqlDbType.UniqueIdentifier, colorID),
                    new SqlQueryParameter(COL_DB_ORDERLOTQTY, SqlDbType.Int, orderLotQty),
                    new SqlQueryParameter(COL_DB_QTY, SqlDbType.Int, qty),
                    new SqlQueryParameter(COL_DB_PONOTES, SqlDbType.VarChar, Util.wrapNullable(poNotes)),
                    new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
        public static string submitNew(string barcodeWithoutPrefix, bool isManualInput, bool rescanToday, bool ignoreSold, string itemLocation)
        {
            if (barcodeWithoutPrefix.Length != Settings.itemBarcodeLength)
            {
                return(barcodeWithoutPrefix + " is not a valid item barcode");
            }

            try
            {
                using (SqlCommand cmd = new SqlCommand("inventoryitemcheck_new", DBConnection.ActiveSqlConnection))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@id", SqlDbType.UniqueIdentifier).Value            = Guid.NewGuid();
                    cmd.Parameters.Add("@BarcodeWithoutPrefix", SqlDbType.VarChar).Value   = barcodeWithoutPrefix;
                    cmd.Parameters.Add("@user_id", SqlDbType.UniqueIdentifier).Value       = GlobalData.UserAccount.id;
                    cmd.Parameters.Add("@" + COL_DB_MANUALINPUT, SqlDbType.Bit).Value      = isManualInput;
                    cmd.Parameters.Add("@" + FILTER_RescanToday, SqlDbType.Bit).Value      = rescanToday;
                    cmd.Parameters.Add("@" + COL_DB_IgnoreSold, SqlDbType.Bit).Value       = ignoreSold;
                    cmd.Parameters.Add("@" + COL_DB_ItemLocation, SqlDbType.VarChar).Value = itemLocation;
                    SqlParameter InventoryItems_id = cmd.Parameters.Add("@InventoryItems_id", SqlDbType.UniqueIdentifier);
                    InventoryItems_id.Direction = ParameterDirection.Output;
                    SqlParameter opnameMarker = cmd.Parameters.Add("@opnameMarker", SqlDbType.Bit);
                    opnameMarker.Direction = ParameterDirection.Output;
                    SqlParameter inventoryCode = cmd.Parameters.Add("@inventory_code", SqlDbType.VarChar, 10);
                    inventoryCode.Direction = ParameterDirection.Output;
                    SqlParameter itemLength = cmd.Parameters.Add("@item_length", SqlDbType.Int);
                    itemLength.Direction = ParameterDirection.Output;
                    SqlParameter errorcodevalue = cmd.Parameters.Add("@errorcode", SqlDbType.TinyInt);
                    errorcodevalue.Direction = ParameterDirection.Output;

                    cmd.ExecuteNonQuery();

                    int errorcode = Convert.ToInt32(errorcodevalue.Value);
                    if (errorcode > 0)
                    {
                        if (errorcode == 1)
                        {
                            return(barcodeWithoutPrefix + " is not found in database");
                        }
                        if (errorcode == 2)
                        {
                            return(barcodeWithoutPrefix + " is already scanned today");
                        }
                        if (errorcode == 3 && !ignoreSold)
                        {
                            return(barcodeWithoutPrefix + " is already sold");
                        }
                    }

                    ActivityLog.submit(new Guid(InventoryItems_id.Value.ToString()), "Opname");

                    Tools.displayForm(new SharedForms.Verify_Form(inventoryCode.Value.ToString(), itemLength.Value.ToString(), (decimal)(.5)));
                    if (Convert.ToBoolean(opnameMarker.Value))
                    {
                        Settings.opnameMarkerSound.Play();
                    }
                    else
                    {
                        Settings.notificationSound.Play();
                    }
                }
            }
            catch (Exception ex) { return(ex.Message); }

            return(string.Empty);
        }
示例#13
0
        public static void update(Guid id, string storageName, string vendorName, string vendorInfo, string description, DateTime?priceDate, decimal?pricePerUnit, DateTime?discontinueDate, string notes, Guid?lengthUnitID, decimal?sellPricePerUnit)
        {
            Sample objOld = new Sample(id);

            //generate log description
            string logDescription = "";

            if (objOld.StorageName != storageName)
            {
                logDescription = Tools.append(logDescription, String.Format("Storage Name: '{0}' to '{1}'", objOld.StorageName, storageName), ",");
            }
            if (objOld.VendorName != vendorName)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor Name: '{0}' to '{1}'", objOld.VendorName, vendorName), ",");
            }
            if (objOld.VendorInfo != vendorInfo)
            {
                logDescription = Tools.append(logDescription, String.Format("Vendor Info: '{0}' to '{1}'", objOld.VendorInfo, vendorInfo), ",");
            }
            if (objOld.Description != description)
            {
                logDescription = Tools.append(logDescription, String.Format("Description: '{0}' to '{1}'", objOld.Description, description), ",");
            }
            if (objOld.PriceDate != priceDate)
            {
                logDescription = Tools.append(logDescription, String.Format("Price Date: '{0:MM/dd/yy}' to '{1:MM/dd/yy}'", objOld.PriceDate, priceDate), ",");
            }
            if (objOld.PricePerUnit != pricePerUnit)
            {
                logDescription = Tools.append(logDescription, String.Format("Price Per Unit: '{0:N2}' to '{1:N2}'", objOld.PricePerUnit, pricePerUnit), ",");
            }
            if (objOld.DiscontinueDate != discontinueDate)
            {
                logDescription = Tools.append(logDescription, String.Format("Discontinue Date: '{0:MM/dd/yy}' to '{1:MM/dd/yy}'", objOld.DiscontinueDate, discontinueDate), ",");
            }
            if (objOld.Notes != notes)
            {
                logDescription = Tools.append(logDescription, String.Format("Notes: '{0}' to '{1}'", objOld.Notes, notes), ",");
            }
            logDescription = ActivityLog.appendChange(logDescription, objOld.SellPricePerUnit, sellPricePerUnit, "Sell Price: '{0}' to '{1}'");
            logDescription = ActivityLog.appendChange(logDescription, objOld.LengthUnitName, new LengthUnit(lengthUnitID).Name, "Unit: '{0}' to '{1}'");

            if (!string.IsNullOrEmpty(logDescription))
            {
                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "sample_update",
                    new SqlQueryParameter(COL_DB_ID, SqlDbType.UniqueIdentifier, id),
                    new SqlQueryParameter(COL_DB_STORAGENAME, SqlDbType.VarChar, storageName),
                    new SqlQueryParameter(COL_DB_VENDORNAME, SqlDbType.VarChar, vendorName),
                    new SqlQueryParameter(COL_DB_VENDORINFO, SqlDbType.VarChar, vendorInfo),
                    new SqlQueryParameter(COL_DB_DESCRIPTION, SqlDbType.VarChar, description),
                    new SqlQueryParameter(COL_DB_PRICEDATE, SqlDbType.DateTime, Util.wrapNullable(priceDate)),
                    new SqlQueryParameter(COL_DB_PRICEPERUNIT, SqlDbType.Decimal, Util.wrapNullable(pricePerUnit)),
                    new SqlQueryParameter(COL_DB_DISCONTINUEDATE, SqlDbType.DateTime, Util.wrapNullable(discontinueDate)),
                    new SqlQueryParameter(COL_DB_LENGTHUNITID, SqlDbType.UniqueIdentifier, Util.wrapNullable(lengthUnitID)),
                    new SqlQueryParameter(COL_DB_SELLPRICEPERUNIT, SqlDbType.Decimal, Util.wrapNullable(sellPricePerUnit)),
                    new SqlQueryParameter(COL_DB_NOTES, SqlDbType.VarChar, Util.wrapNullable(notes))
                    );

                if (result.IsSuccessful)
                {
                    ActivityLog.submitUpdate(id, logDescription);
                }
            }
        }
示例#14
0
        public static bool update(Guid saleID, Guid?Customers_Id, Guid?Vendors_Id, DataTable saleItems, Guid?transportID, decimal shippingCost, string notes)
        {
            Sale      objOld       = new Sale(saleID);
            DataTable objOldItems  = Tools.setDataTablePrimaryKey(SaleItem.getItems(saleID), SaleItem.COL_ID);
            string    customerInfo = objOld.customer_info;

            //generate log description
            string log = "";

            //update customer/vendor info
            Customer newCustomer = new Customer(Customers_Id);

            if (objOld.customer_id != newCustomer.ID)
            {
                log = Util.appendChange(log, objOld.Customers_Name, newCustomer.Name, "Customer: '{0}' to '{1}'");
                log = Util.appendChange(log, objOld.customer_info, newCustomer.Info, "Info: '{0}' to '{1}'");
            }
            Vendor newVendor = new Vendor(Vendors_Id);

            if (objOld.Vendors_Id != Vendors_Id)
            {
                log = Util.appendChange(log, objOld.Vendors_Name, newVendor.Name, "Vendor: '{0}' to '{1}'");
                log = Util.appendChange(log, objOld.customer_info, newVendor.Info, "Info: '{0}' to '{1}'");
            }
            if (Customers_Id != null)
            {
                customerInfo = newCustomer.Info;
            }
            else
            {
                customerInfo = newVendor.Info;
            }

            log = ActivityLog.appendChange(log, objOld.TransportName, new Transport(transportID).Name, "Angkutan: '{0}' to '{1}'");
            log = ActivityLog.appendChange(log, objOld.ShippingCost.ToString("N2"), shippingCost.ToString("N2"), "Shipping: '{0}' to '{1}'");
            log = ActivityLog.appendChange(log, objOld.notes, notes, "Notes: '{0}' to '{1}'");

            DataRow row;
            Guid    id;
            decimal oldAdjustment, newAdjustment;

            for (int i = saleItems.Rows.Count - 1; i >= 0; i--)
            {
                row           = saleItems.Rows[i];
                id            = DBUtil.parseData <Guid>(row, SaleItem.COL_ID);
                newAdjustment = DBUtil.parseData <decimal>(row, SaleItem.COL_ADJUSTMENT);
                oldAdjustment = DBUtil.parseData <decimal>(objOldItems.Rows.Find(id), SaleItem.COL_ADJUSTMENT);
                if (oldAdjustment != newAdjustment)
                {
                    log = ActivityLog.appendChange(log, oldAdjustment, newAdjustment, "Inventory Item " + DBUtil.parseData <string>(row, SaleItem.COL_BARCODE) + " adjustment: {0:N2} to {1:N2}");
                    row[SaleItem.COL_ADJUSTMENT] = newAdjustment;
                }
                else
                {
                    //remove if has no change
                    saleItems.Rows.RemoveAt(i);
                }
            }

            if (!string.IsNullOrEmpty(log))
            {
                //format notes
                if (string.IsNullOrWhiteSpace(notes))
                {
                    notes = null;
                }
                else
                {
                    notes = string.Format("{0:MM/dd/yy}-{1}: {2}", DateTime.Now, GlobalData.UserAccount.name, notes);
                }

                SqlQueryResult result = DBConnection.query(
                    false,
                    DBConnection.ActiveSqlConnection,
                    QueryTypes.ExecuteNonQuery,
                    "sale_update",
                    new SqlQueryParameter(COL_ID, SqlDbType.UniqueIdentifier, saleID),
                    new SqlQueryParameter(COL_CUSTOMER_ID, SqlDbType.UniqueIdentifier, Util.wrapNullable(Customers_Id)),
                    new SqlQueryParameter(COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier, Util.wrapNullable(Vendors_Id)),
                    new SqlQueryParameter(COL_DB_CUSTOMERINFO, SqlDbType.VarChar, Util.wrapNullable(customerInfo)),
                    new SqlQueryParameter(COL_DB_TRANSPORTID, SqlDbType.UniqueIdentifier, Util.wrapNullable(transportID)),
                    new SqlQueryParameter(COL_DB_SHIPPINGCOST, SqlDbType.Decimal, shippingCost),
                    new SqlQueryParameter(COL_DB_Notes, SqlDbType.VarChar, Util.wrapNullable(notes))
                    );

                if (!result.IsSuccessful)
                {
                    return(false);
                }
                else
                {
                    ActivityLog.submit(saleID, "Update: " + log);

                    if (saleItems.Rows.Count > 0)
                    {
                        SaleItem.updateItems(getListOfSaleItemsForUpdate(saleID, saleItems));
                    }
                }
            }

            return(true);
        }