Exemplo n.º 1
0
        public static DataTable getChartDataDetailByCustomers(DateTime?dateStart, DateTime?dateEnd, Guid?excludeCustomerID, DataTable dtCustomersID, DataTable dtGradeID,
                                                              DataTable dtProductStoreNameID, DataTable dtProductWidthID, DataTable dtLengthUnitID, DataTable dtColorID, bool isReportedOnly)
        {
            DataTable dataTable = new DataTable();

            using (SqlCommand cmd = new SqlCommand("sale_charting_detailbycustomers", DBConnection.ActiveSqlConnection))
                using (SqlDataAdapter adapter = new SqlDataAdapter())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@date_start", SqlDbType.DateTime).Value = Util.wrapNullable(dateStart);
                    cmd.Parameters.Add("@date_end", SqlDbType.DateTime).Value   = Util.wrapNullable(dateEnd);
                    cmd.Parameters.Add("@exclude_customer_id", SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(excludeCustomerID);
                    cmd.Parameters.Add("@is_reported_only", SqlDbType.Bit).Value = isReportedOnly;
                    DBUtil.addListParameter(cmd, "@customer_id_list", dtCustomersID);
                    DBUtil.addListParameter(cmd, "@grade_id_list", dtGradeID);
                    DBUtil.addListParameter(cmd, "@product_storenameid_list", dtProductStoreNameID);
                    DBUtil.addListParameter(cmd, "@product_widthid_list", dtProductWidthID);
                    DBUtil.addListParameter(cmd, "@length_unitid_list", dtLengthUnitID);
                    DBUtil.addListParameter(cmd, "@colorid_list", dtColorID);

                    adapter.SelectCommand = cmd;
                    adapter.Fill(dataTable);
                }

            return(dataTable);
        }
Exemplo n.º 2
0
        public static DataTable get(DateTime?dateStart, DateTime?dateEnd, Guid?inventoryID, Guid?customerID, Guid?Vendors_Id, Guid?saleID,
                                    bool onlyHasReceivable, bool OnlyNoFakturPajak, bool onlyLossProfit, bool onlyReturnedToSupplier, bool onlyWithCommission, Guid?salesUserAccountID,
                                    DataTable dtProductStoreNameID, DataTable dtColorID, bool onlyNotCompleted, bool onlyManualAdjustment, string inventoryCode,
                                    Guid?FakturPajaks_Id, Guid?BrowsingForFakturPajak_Customers_Id, Guid?BrowsingForFakturPajak_Vendors_Id, Guid?VendorInvoices_Id,
                                    bool showOnlyReminder_MasukanRetur, bool showOnlyReminder_Keluaran, Guid?Kontrabons_Id)
        {
            DataTable dataTable = new DataTable();

            using (SqlCommand cmd = new SqlCommand("Sales_get", DBConnection.ActiveSqlConnection))
                using (SqlDataAdapter adapter = new SqlDataAdapter())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@date_start", SqlDbType.DateTime).Value = (object)dateStart ?? DBNull.Value;
                    cmd.Parameters.Add("@date_end", SqlDbType.DateTime).Value   = (object)dateEnd ?? DBNull.Value;
                    cmd.Parameters.Add("@inventory_item_id", SqlDbType.UniqueIdentifier).Value    = (object)inventoryID ?? DBNull.Value;
                    cmd.Parameters.Add("@customer_id", SqlDbType.UniqueIdentifier).Value          = (object)customerID ?? DBNull.Value;
                    cmd.Parameters.Add("@" + COL_DB_Vendors_Id, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(Vendors_Id);
                    cmd.Parameters.Add("@sale_id", SqlDbType.UniqueIdentifier).Value                   = (object)saleID ?? DBNull.Value;
                    cmd.Parameters.Add("@only_has_receivable", SqlDbType.Bit).Value                    = onlyHasReceivable;
                    cmd.Parameters.Add("@only_loss_profit", SqlDbType.Bit).Value                       = onlyLossProfit;
                    cmd.Parameters.Add("@include_special_user_only", SqlDbType.Bit).Value              = GlobalData.UserAccount.role == Roles.Super;
                    cmd.Parameters.Add("@" + FILTER_OnlyNoFakturPajak, SqlDbType.Bit).Value            = OnlyNoFakturPajak;
                    cmd.Parameters.Add("@" + FILTER_OnlyReturnedToSupplier, SqlDbType.Bit).Value       = onlyReturnedToSupplier;
                    cmd.Parameters.Add("@" + FILTER_OnlyNotCompleted, SqlDbType.Bit).Value             = onlyNotCompleted;
                    cmd.Parameters.Add("@" + FILTER_Inventory_Code, SqlDbType.VarChar).Value           = Util.wrapNullable <string>(inventoryCode);
                    cmd.Parameters.Add("@" + FILTER_OnlyManualAdjustment, SqlDbType.Bit).Value         = onlyManualAdjustment;
                    cmd.Parameters.Add("@" + COL_DB_FakturPajaks_Id, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(FakturPajaks_Id);
                    cmd.Parameters.Add("@" + COL_DB_Kontrabons_Id, SqlDbType.UniqueIdentifier).Value   = Util.wrapNullable(Kontrabons_Id);
                    cmd.Parameters.Add("@" + FILTER_BrowsingForFakturPajak_Customers_Id, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(BrowsingForFakturPajak_Customers_Id);
                    cmd.Parameters.Add("@" + FILTER_BrowsingForFakturPajak_Vendors_Id, SqlDbType.UniqueIdentifier).Value   = Util.wrapNullable(BrowsingForFakturPajak_Vendors_Id);
                    cmd.Parameters.Add("@" + FILTER_VendorInvoices_Id, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(VendorInvoices_Id);
                    cmd.Parameters.Add("@" + FILTER_ShowOnlyReminder_MasukanRetur, SqlDbType.Bit).Value  = showOnlyReminder_MasukanRetur;
                    cmd.Parameters.Add("@" + FILTER_ShowOnlyReminder_Keluaran, SqlDbType.Bit).Value      = showOnlyReminder_Keluaran;
                    if (onlyWithCommission)
                    {
                        if (salesUserAccountID == null)
                        {
                            cmd.Parameters.Add("@" + Sale.COL_DB_SaleCommission_Users_Id, SqlDbType.UniqueIdentifier).Value = GlobalData.UserAccount.id;
                        }
                        else
                        {
                            cmd.Parameters.Add("@" + Sale.COL_DB_SaleCommission_Users_Id, SqlDbType.UniqueIdentifier).Value = salesUserAccountID;
                        }
                    }
                    DBUtil.addListParameter(cmd, "@productstorename_id_list", dtProductStoreNameID);
                    DBUtil.addListParameter(cmd, "@color_id_list", dtColorID);



                    adapter.SelectCommand = cmd;
                    adapter.Fill(dataTable);
                }

            return(dataTable);
        }
Exemplo n.º 3
0
        public static DataTable get(bool includeInactive, bool last3Months, int?code, DataTable dtProductStoreNameID, DataTable dtGradeID, DataTable dtProductWidthID, DataTable dtLengthUnitID,
                                    DataTable dtColorID, Guid?vendorID, Guid?vendorInvoiceID, bool showNotBookedOnly)
        {
            //ERROR INVALID ARRAY SIZE
            //SqlQueryResult result = DBConnection.query(
            //    true,
            //    DBConnection.ActiveSqlConnection,
            //    QueryTypes.FillByAdapter,
            //    "inventory_getall",
            //        DBConnection.createTableParameters(
            //            new SqlQueryTableParameterGuid("grade_id_list", dtGradeID),
            //            new SqlQueryTableParameterGuid("productstorename_id_list", dtProductStoreNameID),
            //            new SqlQueryTableParameterGuid("productwidth_id_list", dtProductWidthID),
            //            new SqlQueryTableParameterGuid("lengthunit_id_list", dtLengthUnitID),
            //            new SqlQueryTableParameterGuid("color_id_list", dtColorID)
            //        ),
            //    new SqlQueryParameter("include_inactive", SqlDbType.Bit, includeInactive),
            //    new SqlQueryParameter("last3Months", SqlDbType.Bit, last3Months),
            //    new SqlQueryParameter("code", SqlDbType.VarChar, code),
            //    new SqlQueryParameter("FILTER_ShowNotBookedOnly", SqlDbType.Bit, showNotBookedOnly),
            //    new SqlQueryParameter(COL_VENDORID, SqlDbType.UniqueIdentifier, Util.wrapNullable(vendorID)),
            //    new SqlQueryParameter(COL_DB_VENDORINVOICEID, SqlDbType.UniqueIdentifier, Util.wrapNullable(vendorInvoiceID))
            //    );
            //return result.Datatable;

            DataTable dataTable = new DataTable();

            using (SqlCommand cmd = new SqlCommand("inventory_getall", DBConnection.ActiveSqlConnection))
                using (SqlDataAdapter adapter = new SqlDataAdapter())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@include_inactive", SqlDbType.Bit).Value                       = includeInactive;
                    cmd.Parameters.Add("@last3Months", SqlDbType.Bit).Value                            = last3Months;
                    cmd.Parameters.Add("@code", SqlDbType.VarChar).Value                               = code;
                    cmd.Parameters.Add("@FILTER_ShowNotBookedOnly", SqlDbType.Bit).Value               = showNotBookedOnly;
                    cmd.Parameters.Add("@" + COL_VENDORID, SqlDbType.UniqueIdentifier).Value           = Util.wrapNullable(vendorID);
                    cmd.Parameters.Add("@" + COL_DB_VENDORINVOICEID, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(vendorInvoiceID);

                    DBUtil.addListParameter(cmd, "@grade_id_list", dtGradeID);
                    DBUtil.addListParameter(cmd, "@productstorename_id_list", dtProductStoreNameID);
                    DBUtil.addListParameter(cmd, "@productwidth_id_list", dtProductWidthID);
                    DBUtil.addListParameter(cmd, "@lengthunit_id_list", dtLengthUnitID);
                    DBUtil.addListParameter(cmd, "@color_id_list", dtColorID);

                    adapter.SelectCommand = cmd;
                    adapter.Fill(dataTable);
                }

            return(dataTable);
        }
Exemplo n.º 4
0
        public static DataTable get(bool includeInactive, DataTable categoryEnumIDList, Guid?ID, string nameFilter, Guid?vendorID, Guid?retailLengthUnitID, Guid?bulkLengthUnitID, Guid?productWidthID)
        {
            DataTable datatable = new DataTable();

            using (SqlCommand cmd = new SqlCommand("gordenitem_get", DBConnection.ActiveSqlConnection))
                using (SqlDataAdapter adapter = new SqlDataAdapter())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@" + FILTER_INCLUDEINACTIVE, SqlDbType.Bit).Value = includeInactive;
                    DBUtil.addListParameter(cmd, "@" + FILTER_CATEGORYENUMIDLIST, categoryEnumIDList);
                    cmd.Parameters.Add("@" + COL_DB_ID, SqlDbType.UniqueIdentifier).Value                 = Util.wrapNullable(ID);
                    cmd.Parameters.Add("@" + COL_DB_NAME, SqlDbType.VarChar).Value                        = Util.wrapNullable(nameFilter);
                    cmd.Parameters.Add("@" + COL_DB_VENDORID, SqlDbType.UniqueIdentifier).Value           = Util.wrapNullable(vendorID);
                    cmd.Parameters.Add("@" + COL_DB_RETAILLENGTHUNITID, SqlDbType.UniqueIdentifier).Value = Util.wrapNullable(retailLengthUnitID);
                    cmd.Parameters.Add("@" + COL_DB_BULKLENGTHUNITID, SqlDbType.UniqueIdentifier).Value   = Util.wrapNullable(bulkLengthUnitID);
                    cmd.Parameters.Add("@" + COL_DB_PRODUCTWIDTHID, SqlDbType.UniqueIdentifier).Value     = Util.wrapNullable(productWidthID);

                    adapter.SelectCommand = cmd;
                    adapter.Fill(datatable);
                }
            Tools.parseEnum <GordenItemCategories>(datatable, COL_CATEGORYNAME, COL_DB_CATEGORYENUMID);

            return(datatable);
        }